Final modifier class
Subclass is not allowed.
Modify variable
Once an initial value is obtained, the variable cannot be changed and cannot be assigned a value again.
Member variables: The initial value must be explicitly set by the programmer and is not implicitly initialized by the system.
Class variable: Static initialization block | when declaring this type of Variable
Instance variables: Non-static initialization block | when declaring the instance variable | in the constructor
Local variable: The initial value must be explicitly set by the programmer and is not implicitly initialized by the system.
Specified when defining variables | specified in later code
The parameter variable is initialized by the input parameter value, so it cannot be assigned a value.
Basic Type Variable: Values can be assigned only once.
Reference Type Variable: The referenced address will not change, that is, only one object will be referenced, but the object content can be completely changed.
Macro variable:Use final modification to specify the initial value when defining a variable. The final modified variable value can be determined during program compilation.
This variable is essentially a "macro variable". The compiler will replace the place where the variable is used in the program with the value of this variable.
Modifier
Method cannot be overwritten
Use final to modify a private access permission. You can define a method in the subclass that is the same as the method name, parameter list, and return value type as this method.
Final modifier-Immutable