这个问题其实问题点在于这个方法本身的定义
* @return The {@code Class} object that represents the runtime
* class of this object.
* @see Class Literals, section 15.8.2 of
* <cite>The Java™ Language Specification</cite>.
*/
public final native Class<?> getClass();
这个方法继承与Object,定义解释的比较清楚,返回的是当前运行类的Class,这样一来下面例子的问题也就清楚了
package testKeywords;
import java.util.Date;
public class TestSuper extends Date{
public static void main(String[] args) {
new TestSuper().test();
}
public void test(){
System.out.println(super.getClass().getName());
}
}