Chapter VI - Access Control

6.1 package - library units
to resolve naming conflicts
6.1.1
a java source file is a compilation unit, in a compilation unit there can be a public class, and the class name must match the name of the file compilation unit, ending with the suffix .java , including case. And most one public class. If the bag there are other classes, classes outside the package can not see these classes, they are mainly class-based public support.
Use package, which must be the first line of a non-code comments. Rule package name is all lowercase.
6.1.2 create a unique package name
6.1.3 custom tool library
6.1.4 with import behavioral change
access modifiers the Java 6.2
6.2.1 package access - Friendly
6.2.2 public open access
6.2.3 private - private access
6.2.4 protected - inherit access
6.3 interface and implementation
public -> protected -> friendly - > private
access to the 6.4 class - only the pubic and package
each compilation unit can only have a public-modified class, if any, , the file name must match the name of the class. Compilation unit that does not contain a public class is also possible, this time on the name of the file without any constraints.
If you do not create any constructor, the compiler will create a default constructor with no arguments. Once you have created a constructor, the compiler does not create.

Guess you like

Origin www.cnblogs.com/mature-mike/p/11441312.html