public class SE extends Date{
public static void main(String[] args) {
new SE().test();
}
void test(){
System.out.println(super.getClass().getSimpleName());
}
}
谁能分析下为什么输出是SE,而不是Date
getClass():Returns the runtime class of this Object. The returned Class object is the object that is locked by static synchronized methods of the represented class.
getSuperclass():Returns the Class representing the superclass of the entity (class, interface, primitive type or void) represented by this Class. If this Class represents either the Object class, an interface, a primitive type, or void, then null is returned. If this object represents an array class then the Class object representing the Object class is returned.