Class getGenericInterfaces() method in Java with Examples Last Updated : 28 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The getGenericInterfaces() method of java.lang.Class class is used to get the type of interfaces directly implemented by this entity. This entity can be a class or an interface. The method returns an array of type of interfaces directly implemented by this entity. Syntax: public Type[] getGenericInterfaces() Parameter: This method does not accept any parameter. Return Value: This method returns an array of type of interfaces directly implemented by this entity. Below programs demonstrate the getGenericInterfaces() method. Example 1: Java // Java program to demonstrate // getGenericInterfaces() method import java.util.*; public class Test { public static void main(String[] args) throws ClassNotFoundException { // returns the Class object for this class Class myClass = Class.forName("Test"); System.out.println("Class represented by myClass: " + myClass.toString()); // Get the type of interfaces of myClass // using getGenericInterfaces() method System.out.println( "GenericInterfaces of myClass: " + Arrays.toString( myClass.getGenericInterfaces())); } } Output: Class represented by myClass: class Test GenericInterfaces of myClass: [] Example 2: Java // Java program to demonstrate // getGenericInterfaces() method import java.util.*; interface Arr { } public class Test implements Arr { public static void main(String[] args) throws ClassNotFoundException { // returns the Class object Class myClass = Class.forName("Test"); // Get the type of interfaces of myClass // using getGenericInterfaces() method System.out.println( "GenericInterfaces of myClass: " + Arrays.toString( myClass.getGenericInterfaces())); } } Output: GenericInterfaces of myClass: [interface Arr] Reference: https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html#getGenericInterfaces-- Comment More infoAdvertise with us Next Article Class getGenericInterfaces() method in Java with Examples S srinam Follow Improve Article Tags : Java Java-lang package Java-Functions Java.lang.Class Practice Tags : Java Similar Reads Class getInterfaces() method in Java with Examples The getInterfaces() method of java.lang.Class class is used to get the interfaces directly implemented by this entity. This entity can be a class or an interface. The method returns an array of interfaces directly implemented by this entity.Syntax: public Class<T>[] getInterfaces() Parameter: 2 min read Class getAnnotatedInterfaces() method in Java with Examples The getAnnotatedInterfaces() method of java.lang.Class class is used to get the superinterface type annotations present in this class. The method returns an array of annotations present. Syntax: public Annotation[] getAnnotatedInterfaces() Parameter: This method does not accepts any parameter.Return 2 min read Class getGenericSuperclass() method in Java with Examples The getGenericSuperclass() method of java.lang.Class class is used to get the type of the superclass of this entity. This entity can be a class, an array, an interface, etc. The method returns the type of the superclass of this entity.Syntax: public Type getGenericSuperclass() Parameter: This method 2 min read Class getSigners() method in Java with Examples The getSigners() method of java.lang.Class class is used to get the signers of this class. The method returns the signers of this class. If this object represents a primitive type or void, then this method returns null. Syntax: public Object[] getSigners() Parameter: This method does not accept any 2 min read Class isInterface() method in Java with Examples The isInterface() method of java.lang.Class class is used to check if this Class is an interface. The method returns true if this Class is an interface. It returns false otherwise. Syntax: public boolean isInterface() Parameter: This method does not accept any parameter. Return Value: This method re 2 min read Like