The superclass of primitive types is always null : SuperClass « Reflection « Java






The superclass of primitive types is always null

  

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

    Class cls = int.class;
    Class sup = cls.getSuperclass(); // null
  }
}

   
    
  








Related examples in the same category

1.Getting the Superclass of an Object
2.Superclass of Object is 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