Determining If a Class Object Represents a Class or Interface : Interface « Reflection « Java






Determining If a Class Object Represents a Class or Interface

   
public class Main {
  public static void main(String[] argv) throws Exception {
    Class cls = java.lang.String.class;
    boolean isClass = !cls.isInterface(); // true

    cls = java.lang.Cloneable.class;
    isClass = !cls.isInterface(); // false

  }
}

   
    
    
  








Related examples in the same category

1.Class Reflection: is it an interfaceClass Reflection: is it an interface
2.Class Reflection: implemented interfaces
3.The superclass of interfaces is always null
4.Listing the Interfaces That a Class Implements
5.The interfaces for a primitive type is an empty array
6.Get Super Interfaces
7.Listing the Interfaces That an Interface Extends
8.Returns true if type is implementing Map
9.Search over classpath retrieving classes that implement a certain interface
10.Returns true if a class implements Serializable and false otherwise.