This: Looks like the case for distinguishing between local variables and member variables
This is the object that represents this class, this represents the reference to the object to which the method belongs.
Calls between construction methods can only be done by the this statement
The This statement can only appear in the first row when the call is made between constructors, the constructor is executed first, and if there is initialization in the initialization, the more detailed initialization
classg{PrivateString name; Private intAge = 19; G (String name) {System.out.println (name); System.out.println (age); System.out.println ("The above output is a method of constructing a parameter"); } G (String name,intAge ) { This(name);//call other constructors of the current objectSystem.out.println ("Here is a method of constructing two parameters"); }}/*this: It appears to be used to differentiate between local variables and member variables this: that is, representing this class of objects, this represents the reference to the object in which the method belongs, the call between the constructor method can only be made through the this statement to complete the call between the constructor method, the this statement can only appear in the first row, The construction method is executed first, and if there is initialization in the initialization, then the more detailed initialization is performed .*/ Public classindex{ Public Static voidMain (string[] args) {G G1=NewG ("Xiaoming", 19); }}
Calls between JAVA constructor methods