Get interface for a primitive type in Java

Description

The following code shows how to get interface for a primitive type.

Example


/*from ww  w  .ja v a  2  s  .c  o m*/
import java.util.Arrays;

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

    Class cls = int.class;
    Class[] intfs = cls.getInterfaces(); // []
    System.out.println(Arrays.toString(intfs)); 
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Reflection »




Annotation
Array
Class
Constructor
Field
Generics
Interface
Method
Modifier
Package
Proxy