1. Superkeyword denotes the meaning of the super (parent) class. The This variable represents the object itself.
2. Super Access the parent quilt class hidden variables or overridden methods. The current class hypothesis is inherited from the superclass when super is called. XX () is the XX () method that calls the base class version number.
The superclass is the recent parent class.
3. Call the super () parent class constructor only to invoke the first line in the subclass constructor
4. Thiscan only be used in non-static methods in a class. This is absolutely not allowed in static methods and static blocks of code, which are explained clearly in the article "javakeywordstatic, Final use summary".
And this is only associated with a particular object, not with a class, different objects of the same class have a different this
Liezi:
Class Person { protected void print () { System.out.println ("The Print ()-Class person."), }} public class De Mosuper extends Person {public demosuper () { super ();//Call the constructor method of the parent class. And put the first line. If you do not write, the system itself is actively added } public void print () { System.out.println ("The Print () in class Demosuper."); Super.print ();//Call the method of the parent class } public static void Main (string[] args) { demosuper ds = new Demosuper (); Ds.print (); }}
Java Fundamentals-Super and this parsing