There are classes in Java, there are member variables, there are member methods, there are local variables. What can they do with each other?
Classes that are currently being learned have common classes and inner classes.
I. Modifying a general class:
1.public only one class in each file can be modified by public, indicating that it can be accessed by any object
2.abstract abstract class, can not be instantiated, there may be an abstract method. The effect of no abstract method is to avoid instantiating the class
3.final final class, indicating that it cannot be inherited
4.abstract abstract class, cannot be instantiated, is the new object
Inner class: Has member inner class, local inner class, anonymous inner class, Static inner class (skip first)
Two. Modifier variables: Variables have member variables and local variables
Modify member Variables:
1.public can be accessed by any object
2.private can only be used by its own class
3.protected In addition to its own class, the same package, sub-class other than can not be used, quilt class overrides
4.final represents the constant amount of the member variable, but the initialization cannot be changed;
5.static static member variables, which are loaded when the class is loaded, are not dependent on instantiation, and can be used with the class name. Variable name. And the variable has only one copy in the class, which means that all objects are used together. (Cannot modify local variables)
To modify a local variable:
1.final is a final modification of the constant, one but initialization, the value cannot be changed
Three: Modification method
1.public Ibid.
2.protected Ibid.
3.private Ibid.
4.static static method, loaded when the class loads. You do not need to create an object to use the class name. Method Name
(cannot be modified together with abstract method, class load to load, and abstract method is an abstraction method, meaningless)
The 5.final method can be inherited by the quilt class, but cannot be overridden
(cannot be combined with abstract method, final cannot be overridden, and abstract requires override)
6.abstract the method has no method body and its class must be defined as an abstract class
(Not with final co-decoration method, same as 5)
IV: Inner class
The member inner class, as the name implies, is similar to a member and can be modified by modifying the member variable. Unlike methods, abstract and static can collectively modify inner classes
Local inner class, similarly, can modify the local variable can modify him, final
Anonymous inner class, there is no definition of class.
A static inner class that modifies a member's inner class to modify it.
Beginner, welcome.
Beginner Summary--------java modifier and cosmetic keyword (also called cosmetic keyword)