Static modifiers
Static modifiers, which are generally decorated members. Members that are modified by static belong to a class and do not belong to an object of a single class.
Members that are modified by static can and recommend direct access through the class name.
Static code block
Definition: is a block of code that is defined at the member location, using static adornments.
Characteristics:
It takes precedence over the execution of the Main method, which takes precedence over the construction of code block execution, when used in any form for the first time to the class.
The static code block executes only once, regardless of how many objects are created.
Can be used to assign a value to a static variable for class initialization
Final keyword
The final decorated class cannot be inherited, but other classes can be inherited.
The final modified method can be inherited and cannot be overridden, but there is no final decorated method in the parent class, and the subclass can be overridden with a final decoration.
Final modifier local variable: One assignment at a time, a lifetime constant, a variable value of a reference type is an object address value, an address value cannot be changed, but an object property value within an address can be modified
Four types of access modifiers
To be accessible only in this class, use the private modifier;
The classes in this package can be accessed without modifiers (default);
To make the class in this package accessible to subclasses in other packages using the protected adornment
All of the classes in this project can be accessed using the public adornment.
Note: If the class is decorated with public, the class name must be the same as the file name. There can be only one public-decorated class in a file.
Basic syntax format in Java 2