List the Interfaces That a Class Implements in Java

Description

The following code shows how to list the Interfaces That a Class Implements.

Example


//from  w  w w.  j av a2  s . c  o  m
import java.util.Arrays;

public class Main {
  public static void main(String[] argv) throws Exception {
    Class cls = java.lang.String.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