true
if this class object represents an annotation type;
false
otherwise. Note that if this method returns true,
Class.isInterface()
would also return true, as all annotation types are also interfaces.
Examples
package com.logicbig.example.clazz;
public class IsAnnotationExample {
public static void main(String... args) { Class<Deprecated> c = Deprecated.class; System.out.println("isAnnotation: "+c.isAnnotation()); System.out.println("isInterface: "+c.isInterface()); } }
Output
isAnnotation: true isInterface: true
package com.logicbig.example.clazz;
public class IsAnnotationExample2 {
public static void main(String... args) { Class<Runnable> c = Runnable.class; System.out.println("isAnnotation: " + c.isAnnotation()); System.out.println("isInterface: " + c.isInterface()); } }