Java similarities and differences in super and this is

No. Point of difference this super
1 Property access Access this class of property, from the parent class if this class does not have to continue to look for this property Access the parent class attributes
2 method Access methods in this class, this class from the parent class if this method does not continue searching Direct access to the parent class method
3 Call the constructor On the first line On the first line
4 special It represents the current object No such concept

Note super only be used in a subclass, which is not represented in the parent master method, super not represented by this object. When super and this method is to call the constructor can not occur simultaneously. The reason is that two should be placed on the first line.

Guess you like

Origin www.cnblogs.com/sogeisetsu/p/12216314.html