modifier

byte short int long float double char boolean 
static methods can only be inherited and cannot be overridden
. When a final-modified class cannot be overridden, the class is a final class and cannot be inherited
. When a final-modified method cannot be overridden
, the property cannot be overridden. Cannot be overwritten
When final modifies a native data type, it means that the value of the native data type cannot change (for example, the value of int type cannot be changed from 10 to 20).
When final modifies a reference type, it means that the reference type can no longer point to There are other objects, but the content of the reference object is a member variable of final type that can be changed


. If you do not assign an initial value when you declare it, you need to assign it in all constructors of the class. The role of the


static code block is Do some initialization work. The static code block is executed first, followed by the constructor.
The static code block is executed when the class is loaded, and the constructor is executed when the object is generated; to call a class to generate an object, the class needs to be loaded into the Java Virtual Machine (JVM) first, and then loaded by the JVM This class is used to generate objects


. The static code block of the class will only be executed once, when the class is loaded, because each class will only be loaded once, so the static code block will only be executed once
. Generate an object each time


If there is a static code block in the inheritance system, the static code block of the top-level class will be executed first, and it will be executed until the static code block of the bottom-level class. Then execute the constructor of the top-level class until the constructor of the bottom-level class is executed. Static code will only be executed once Non-static member variables can


not be accessed in static methods, but static member variables can be accessed in non-static methods The
this keyword cannot be used in static methods


The member variables in the interface are all public static final.


You cannot use both final and abstract to modify protected properties and methods. You can access privately modified properties and methods in the


same package and subclasses of this class.
Internal
use


Instanceof is used inside the class and the classes under the same package without any modifiers to determine whether an object is an instance of a class

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324422333&siteId=291194637