1, the difference between a member variable and a local variable
1) different locations in memory
Member variables: In heap memory (member variables belong to object, object into heap memory)
Local variables: In-stack memory (local variables belong to method, method into stack memory)
2) different initialization values
Member variable: has default initialization value
Local variables: There is no default initialization value, which must be defined and assigned before it can be called.
2. Encapsulation
Private: The modified member can only be accessed in this class
Class Ensultation { new person (). age=10; not this type of error }class person{ private int age; }
Private is simply a form of encapsulation that is not available under the same package (using the default modifier).
3. The construction method also has a return statement, the format is return;
4. Overloading of methods
Constructing method overloads
Overloaded: Method name is the same, regardless of return value type (construction method no return value), see only parameter list
5. If you manually give the construction method, the system will no longer provide a default parameterless construction method
Note: If you want to use a non-parametric construct at this time, you must give it yourself manually, and suggest that you always give the non-parametric structure yourself.
2017/05/16 Java Basics Essay