About this keyword

The essence of this is to "create a good target address", while in the constructor, this also represents "the current object", and this is always going to point to the object initialized.

In the method a plurality constructor overload, the call must use this keyword constructor overload, the initialization code to avoid the same, but only in a constructor, and must be in a structure according to the first, use of this ().

Note, this can not be used in static methods! !

 

User u1 = new User (11, "John Doe")

In this statement, if agreed u1 actually printing the actual address of the object

Guess you like

Origin www.cnblogs.com/ventureZ/p/11099370.html