Java Class.getGenericInterfaces()

Syntax

Class.getGenericInterfaces() has the following syntax.

public Type [] getGenericInterfaces()

Example

In the following code shows how to use Class.getGenericInterfaces() method.


/* www  . j a v a2s. com*/
import java.lang.reflect.Type;

public class Main {

  public static void main(String[] args) {

    Main d = new Main();
    Class c = d.getClass();

    Type[] t = c.getGenericInterfaces();
    if (t.length != 0) {
      for (Type val : t) {
        System.out.println(val.toString());
      }
    } else {
      System.out.println("Interfaces are not implemented...");
    }
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable