List the Interfaces That an Interface Extends in Java

Description

The following code shows how to list the Interfaces That an Interface Extends.

Example


//w w w.ja  v  a2 s.  c  om
import java.util.Arrays;

public class Main {
  public static void main(String[] argv) throws Exception {
    Class cls = java.util.List.class;
    Class[] intfs = cls.getInterfaces(); // java.util.Collection
    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