1. Some modifiers provided in Java, which can modify classes, variables and methods. Common modifiers in Java include: abstract (abstract), static (static), public (public), protected (protected), private (private), synchronized (synchronized), native (local), transient (temporary), volatile (volatile), final (unchangeable)
2. 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.4 accessibility ranges
Note: Top-level classes can only be modified by default modifiers and public, and cannot be modified by private and protected.
IV.abstract modifiers 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 method to represent abstract method. The abstract method has no method body: "{}", used for subclass rewriting
3. In the abstract class modified, that is, there can be ordinary methods and abstract methods in the abstract class.
4. Abstract classes and abstract methods cannot be modified by final modifiers. The abstract modifier and the final modifier cannot be used in conjunction
Five.final modifier
1.final is the meaning of "unchangeable", which can modify non-abstract classes, non-abstract member methods and variables
2. Classes modified with final cannot be inherited and have no subclasses
3. The method modified with final cannot be overwritten by subclass methods.
4. Use final modified variables to represent constants, such as (PI), so they can only be assigned once, and cannot be changed.
6.static modifier
1. Use statically modified member variables to represent static variables, which can be directly accessed through the class name.
2. Use static modified member methods to represent static methods, which can be directly accessed through the class name.
3. Use static modified program to send code blocks. When the full name of Java Virtual Machine (JVM) is: Java Virtual Machine, they can be located in the runtime data area method according to the class name, and can only be run once.
The above are the modifiers in the Java language that the editor introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!