Java Class.isAnnotation()

Syntax

Class.isAnnotation() has the following syntax.

public boolean isAnnotation()

Example

In the following code shows how to use Class.isAnnotation() method.


/*from   w ww .  ja v  a  2  s .  c o  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.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable