In this tutorial we are going to check wheather loaded class is an interface definition or class definition . To check weather the .class file is as interface definition or class definition we have a isInterface() method in java.lang.Class. This method returns true if .class file is interface definition otherwise returns false that indicates class definition. See the below example .

public class Sample {
public static void main(String as[]) throws ClassNotFoundException
{
    Class c1 = Class.forName("java.lang.Runnable"); 
    // Runnable is pre defined interface
    if(c1.isInterface()){
        System.out.println(c1.getName()+" is an interface");
     }
    else{
        System.out.println(c1.getName()+" is a class");
    }
}
}
// Output : java.lang.Runnable is an interface