1, the use of this keyword:
A, member variable and local variable name, call member variable in the method body, need to use
The This keyword.
b, you can use this when passing the class's own instantiated object as a parameter.
C, inner class, calling methods or variables of an external class,
Available: class name. this. (variable or method name)
D, in the same class, you can use the This keyword to invoke an overloaded construction method of the same name, if you call other construction methods in the constructor method,
Must be placed in the first row of the current construction method).
2, the method of parameter delivery:
A, the value of the base data type is passed
b, pointer passing with reference data type
3. Static keyword
A, the static method is a method without this, in the static method body, cannot call the non-static method, also cannot call the nonstatic member variable
Conversely, you can call the static method in the non-static method body. static method,
Called only by means of the class name. Of course, if you use an instantiated object to call the static method, it is also
Yes, it's just not recommended.
b, static variables are also called static variables, the difference between static and non-static variables is: Static variables are all
object, not the current object owned by the static variable, is initialized when the object is created, exists
Multiple replicas, and the static variable does not have more than one copy.
C, static code block, if there is more than one static code block in a class, then the load execution order is executed sequentially
4. jar Package and Library: encapsulation of a range of functions (packaged)
5.super keywords
A, in the parent class existing logic to add some of their own methods, you can use super. Need to be placed first in the current construction method.
B, when a subclass has a member variable of the same name as the parent class, or a member method of the same name, the element in the child class is greater than the precedence of the element in the parent class, so a method or member variable in the parent class needs to be called with the Super keyword
C, through super after directly followed by parameters, you can call the parent class construction method
Usage of this,static keywords in Java