Java key difference of this and super keywords

Numbering Point of difference this super
1 Access Properties

Accessing the class attributes, if this class is not present

Property from the parent class continue to look for

Access the parent class attributes

2 Call the method Access method of the class

Direct access to the parent class method

3 Call the constructor

This class constructor call,

This class constructor must be placed in a first row

Call the parent class constructor,

It must be placed in the first row of the sub-class constructor

4 special It represents the current object No such concept

 

Guess you like

Origin www.cnblogs.com/xiximayou/p/12048694.html