1. Static modifier static acts on code block: called Static code block (can initialize static field, cannot initialize non-static field); Static action on the Methods:static method only accesses the static method, The non-static method can access static fields only and cannot access non-static field non-static methods to access static fields and static methodsstatic Method of two access methods Oject.method and Class.method, non-static method only Object.Method a way of access static This and superstatic cannot be used as local variables (local variables include: function-level local variables and block-level local variables) 2, final modifier cannot be inherited (cannot have abstract final Class) (the method in the final class is automatically final, but does not include attributes) The final method can be inherited but cannot be override cannot have the abstract final Methodfinal property cannot be re-assigned (can be inherited, But not modifiable) can be initialized or uninitialized, and initialized in a statement block or initialized in a constructor (the latest to initialize in a constructor, Can only be initialized once) the final property can only be artificially assigned once and the final property of the parent class cannot be modified final can be decorated with local variables to represent local constants (method-level local variables (parameters and local variables, method body-level local variables) or block-level local variables) 3, Abstract modifier: An abstract class cannot instantiate an object an abstract class may not contain an abstract method, but as long as there is an abstract method the class must have no method body for the abstract class abstract method, A subclass of the Overrideabstract class is required to either implement all of its parent's abstract methods, or an abstract class abstract cannot modify a property abstract cannot modify a local variable (a method-level local variable (a parameter-level local variable). Method body-level local variable) or block-level local variable) 4, final, static, abstract relationship: final, abstract cannot coexist (no matter in class, method, attribute, local variable can not coexist) static, AbstracT cannot coexist (no matter in classes, methods, properties, local variables) can appear final static field (the class member property cannot be modified) can appear final static method (the class member method cannot be override)
Final, static, abstract differences and connections in Java