For this, you can use the isInterface() method of the Class class. What is your reason for this? You have a poorly documented library, where do you need to find out? Perhaps if we knew what you were trying to do, a more elegant solution might be proposed.
if(Class.forName("Person").isInterface()) //do interface stuff else //do class stuff
or
if(Person.class.isInterface()) ...
EDIT: after reading your comment on TJ Crowder's answer. This is what I would do:
if(Person.class.isInterface()) System.out.println("Person is an Interface"); else System.out.println("Person is a class");
Chinmay kanchi
source share