About those modifiers in the Java language
1. Some modifiers provided in java, these modifiers can modify classes, variables and methods. Common modifiers in java are: abstract (abstract), static (static) ), public (public), protected (protected), private (private), synchronized (synchronized), native (local), transient (temporary), volatile (volatile), final (not Changed)
2. The modifiers that modify the top-level class include abstract, public, and final, while static, protected, and private cannot modify the top-level class. Member methods and member variables can have multiple modifiers, while local variables can only be modified with final
Three. Accessible scopes of 4 access levels
Note: Top-level classes can only be modified by default modifiers and public , cannot be modified by private and protected
4. The abstract modifier can be used to modify classes and member methods
1. Use abstract-modified classes to represent abstract classes, abstract classes cannot be instantiated
2. Use abstract-modified methods to represent abstraction Methods, abstract methods have no method body: "{}", used for subclass rewriting
3. Abstract modified classes, that is, abstract classes can have ordinary methods and abstract methods
4. Abstract classes and abstract methods Cannot be modified by the final modifier. Abstract modifier and final modifier cannot be used together
5. Final modifier
1. Final means "immutable", it can modify non-abstract classes, non-abstract member methods and variables
2. Modify with final The class cannot be inherited and has no subclasses
3. Methods modified with final cannot be overridden by methods of subclasses
4. Variables modified with final represent constants, such as (PI), so they can only be assigned once and cannot be Change
6.static modifier
1. Member variables modified with static represent static variables, which can be directly accessed through the class name
2. Member methods modified with static represent static methods, which can be accessed directly through the class name
3. Use the program modified with static to send code blocks. When the full name of Java Virtual Machine (JVM) is: Java Virtual Machine, it can locate them in the method of the runtime data area according to the class name, and it can only be run once