Program to demonstrate how to determine Interfaces implemented by a class dynamically using Java Reflection API.
package com.hubberspot.reflection; // Created two three interfaces just for the demo // such as Shape, Rotation and Movable interface Shape { } interface Rotation { } interface Movable { } // Created a class which implements all those interfaces class Circle implements Shape , Rotation , Movable { } public class InterfacesFinding { public static void main(String[] args) { // Get the instance of Class of the type Circle Class classCircle = Circle.class; // class Class defines a method which returns // an array of interfaces Class[] interfacesArray = classCircle.getInterfaces(); System.out.println("Interfaces implemented by Circle class are : "); for (int i = 0; i < interfacesArray.length; i++) { String interfaceName = interfacesArray[i].getName(); System.out.println(i + 1 + " " +interfaceName); } } }Output of the program :