|
Class-related keywords final, static, this, super
1. Final Modifier
1) final class of the modifier class, which cannot be inherited
2) modify the final variable of a variable, that is, a constant. The constant must be assigned an initial value when it is defined. Final int min; the statement is incorrect.
3) Final method of the modifier, which cannot be overwritten by the quilt class.
2. Static Modifier
1) class variables and instance variables
Instance variables of different objects are allocated with different memory spaces to share the memory space of the same class of variables.
Class variables can be referenced directly by class names, and instance variables must be referenced by class objects.
2) class method and instance method
The class method allocates memory space when the class is added to the memory. It can be directly referenced by the class name.
The instance method allocates memory space only when an object is generated and must be referenced by an object.
Note: The instance variables in the class are not allowed in the class method. You can only use the class variables in the class (in fact, it is easy to understand that the instance variables have not been generated when the class method is called)
The instance method can use both class variables and instance variables.
3, this keyword
This indicates a reference to the class itself (that is, the object itself ).
Http://webservices.ctocio.com.cn/java/213/9194713.shtml
This link is good,
4, super keyword
The super keyword indicates a reference to the parent class. If you want to use the member variables and methods of the overwritten parent class in the subclass, use super. |