Superclass of Object is null : SuperClass « Reflection « Java






Superclass of Object is null

  
public class Main {
  public static void main(String[] argv) throws Exception {

    Object o = new Object();
    Class sup = o.getClass().getSuperclass(); // null
  }
}

   
    
  








Related examples in the same category

1.Getting the Superclass of an Object
2.The superclass of primitive types is always null
3.Although the type of o2 is an interface, getSuperclass() returns the object's superclass
4.Retrieving other information through the class pointer
5.Return true if class a is either equivalent to class b, or if class a is a subclass of class b, i.e. if a either "extends" or "implements" b.
6.Allows the user to reflectively inspect an object hierarchy