Check class type

boolean isAnnotation()
is it an annotation type.
boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
Is an annotation present.
boolean isAnonymousClass()
Is it an anonymous class.
boolean isArray()
Is it an array class.
boolean isAssignableFrom(Class<?> cls)
Is it assigned from.
boolean isEnum()
Is it an enum.
boolean isInstance(Object obj)
Is it instance of another object.
boolean isInterface()
Is it an interface type.
boolean isLocalClass()
Is it a local class.
boolean isMemberClass()
Is it a member class.
boolean isPrimitive()
Is it a primitive type.
boolean isSynthetic()
Is it a synthetic class.

public class Main {

  public static void main(String[] args) {

    
    Class c = new String().getClass();
    
    System.out.println(c.isInterface());

  }
}

The output:


false
Home 
  Java Book 
    Reflection  

Class:
  1. Class Reflection
  2. Get Class from class name
  3. Get class name
  4. Get constructors
  5. Get fields in this class
  6. Get Modifiers
  7. Get package
  8. Check class type
  9. Create new instance
  10. Convert class to string