Verify that the superclass of primitive types is always null in Java

Description

The following code shows how to verify that the superclass of primitive types is always null.

Example


/*w ww .  j  ava2 s  .c  o  m*/
public class Main {
  public static void main(String[] argv) throws Exception {

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




















Home »
  Java Tutorial »
    Reflection »




Annotation
Array
Class
Constructor
Field
Generics
Interface
Method
Modifier
Package
Proxy