Class.isAnnotation() has the following syntax.
public boolean isAnnotation()
In the following code shows how to use Class.isAnnotation() method.
//from ww w.j a va 2 s . co m public class Main{ public static void main(String[] unused) { try { String n = "java.lang.Deprecated"; Class c = Class.forName(n); System.out.println(c.isAnnotation()); } catch (Exception ex) { ex.printStackTrace(); } } }
The code above generates the following result.