1. Static
Modified:
Modifier properties: Class variables, Total class
Modification methods: Static methods, non-static methods and properties cannot be accessed directly in static methods
Static methods can only be overridden by static methods, and there are no polymorphic
A static method or property does not depend on the object: Class name. Method Name (property name Direct access)
Modifying a static block of code: executing under Class loading
Class loading: When the class is first used (before the object is created), the JVM will find the Classpath
Corresponds to the. class file and loads the information for the class.
2. Final
The final
Modifier variables: Constants (values can not be changed, can only be assigned once), when the property is decorated,
Either give the initial value directly or assign a value in the constructor method
Modification method: cannot be overwritten
Modifier class: Cannot be inherited
3. Abstract: abstracted, incomplete
Modified class: Abstract class has a constructor method, but cannot create object
Modification methods: Abstract methods, only declarations, not implemented
public abstract void M1 ();
Attention:
There can be no abstract method in ① abstract class
② If there is an abstract method in a class, then he must be an abstract class
③ if a class inherits an abstract class, but does not want to be an abstract class, the class must actually
All abstract methods in the abstract class now
Interface:
Special abstract Classes
1, the method in the interface is open abstract method; public abstract void M ();
2. All the properties in the interface are public static constants, and all of them will be a = 0;
Keyword for Interface: interface
For a class to implement an interface, the class must implement all the abstract methods in the interface
function of the interface: decoupling
Java three major modifiers