In the object-oriented design, the most critical problem is "will change the things that will not change."
Java source code files are often referred to as compilation units. Each compile unit must be an end of .java
File, and there must be a PUBLIC class with the same file name (case must also be the same, but does not include .java file extension). Each compiler can only have a public class, otherwise the compiler will report an error. If there are other classes inside the compile unit, these classes become the "assist" class of this primary public class, because they are not public, so they can't see the outside world. of.
When programming, public, protected, and private These three Java access controls should be placed in front of the defined section of each member of the class, regardless of this member is data or method. An access control is only the item it defined. This forms a distinct contrast with C . The C access control letter has been tired until another occurs.
Category cannot be private (which in addition to this class yourself, other people can not access) or protected. [30] Therefore, there are only two access rights: package privileges and public. If you don't want others to access this class, you can make it a private, so that no one can create the object of the class. And you can use a Static method to create an object.
Not finished. . .
File, and there must be a PUBLIC class with the same file name (case must also be the same, but does not include .java file extension). Each compiler can only have a public class, otherwise the compiler will report an error. If there are other classes inside the compile unit, these classes become the "assist" class of this primary public class, because they are not public, so they can't see the outside world. of.
When programming, public, protected, and private These three Java access controls should be placed in front of the defined section of each member of the class, regardless of this member is data or method. An access control is only the item it defined. This forms a distinct contrast with C . The C access control letter has been tired until another occurs.
Category cannot be private (which in addition to this class yourself, other people can not access) or protected. [30] Therefore, there are only two access rights: package privileges and public. If you don't want others to access this class, you can make it a private, so that no one can create the object of the class. And you can use a Static method to create an object.
Not finished. . .