1. Static modifier: static
Can be modified: member variables, ordinary methods, internal classes
Cannot be modified: local variables, construction methods, external classes
Access method: class name. variable name/method name
The effect of being modified by static: it will be loaded first by jvm, loaded in a specific area in the heap-----static area, which is changed by all objects, so when an object modifies the method or variable, what about the rest The object or method used by the object is modified.
2. Final modifier: final
Can be modified: external class (cannot be inherited), internal class, member variable (must have an initial value, and cannot be changed after assignment), local variable (cannot be changed after assignment), ordinary method (cannot be overridden by subclasses) )
Can not be modified: construction method
3. Internal category
Declared in the external class, as a member of the external class, a bytecode file will be generated
interview method:
Static inner class with stati modification: new outer class name. inner class name (). method name/variable name
Common inner class: new outer class name (). inner class name (). method name/variable name
Anonymous inner class:
Syntax: interface name/abstract class name object name = new interface name/abstract class name(){ override method };//Be sure to pay attention to the semicolon at the end;
Usage: object name. method name
3. Code block
Is an area defined by {}
Local code block: exists in the method and has no special effect
Static code block: static{} exists in the class, loaded and executed together with the class, priority is higher than the main method
Construction code block: exists in the class, there is no static modification in front, it will be executed every time the construction method is called
4. Enumeration
Global variables: modified by public static final global data that cannot be changed
Enumeration: A structure similar to a class, declared with enum (implicit inheritance of Eunm, can not be written at that time), it will produce bytecode text
Components that can exist: member variables, ordinary methods, static methods, construction methods (the default is private modification)