The packages in the Package java are similar to the namespace in C ++. They are mainly used to prevent name conflicts. The class is included in the package. The package statement should be placed at the beginning. The statement format is generally: package name; for example: [java] view plaincopyprint? Package java. basic; package java. basic; Import in java, similar to include in C ++, the format is as follows: [java] view plaincopyprint? Import java. util. Data; import java. util. Data; classes in Class java are basically the same as those in C ++, but the three access permissions are different. In C ++, the three permissions are as follows: attribute access permission public all protected itself. the sub-class private is only in java. The three permissions are as follows: the attribute access permission is public, and all protected itself. subclass (both inside and outside the package ). all classes in the current package are private. The main difference is protected. in java, all classes in the current package can access members of the protected attribute. In addition, C ++ uses the public attribute by default, while in java, the accessibility of the default attribute is as follows: itself, all classes in the current package. This: this is the same as C ++. Super: This is used in java to access the parent class.