/*
* Write a little bit first, and then specifically have to take the Java programming ideas back to reference
*/
The network to check the Super keyword a lot of ideas are speaking, the Super keyword is a reference to an object of the parent class that represents a parent class object, but the following code test shows that if the parent class is an abstract class, the Superclass keyword can still be used to invoke the non private property or method of the parent class. We all know that abstract classes cannot be instantiated, so this makes me start thinking about what the Super keyword really means (never a parent object).
/*
* Test the Super keyword small problem
*/
Package august26;
public class Test2 {
public static void Main (string[] args) {
TODO auto-generated Method Stub
Son s = new Son ();
S.showinfo ();
}
}
Abstract class Father
{
protected void Showinfo ()
{
System.out.println ("xx");
}
}
Class Son extends Father
{
public void Showinfo ()
{
Super.showinfo ();
System.out.println ("yy");
}
}
Strictly speaking, the This keyword is a reference to a subclass object, and the Super keyword is just a keyword, which is more like an identifier to a parent class.