Class.getInterfaces() has the following syntax.
public Class <?>[] getInterfaces()
In the following code shows how to use Class.getInterfaces() method.
/* w ww . j av a2s. c o m*/ import java.util.Arrays; public class Main { public static void main(String[] args) { Class cls = Thread.class; System.out.println("Class = " + cls.getName()); Class[] c = cls.getClasses(); System.out.println("Classes = " + Arrays.asList(c)); // returns an array of interfaces Class[] i = cls.getInterfaces(); System.out.println("Interfaces = " + Arrays.asList(i)); } }
The code above generates the following result.