Javatpoint Logo
Javatpoint Logo

Java Class getAnnotation() Method

The getAnnotation() method of java Class class returns this element's annotation for the specified type if such an annotation is present, otherwise returns the null.

Syntax

Parameter

A - the type of the annotation to query for and return if present

Returns

This element's annotation for the specified type if such an annotation is present, else return null.

Throws

NullPointerException

Example 1

Test it Now

Output:

Demo_Annotation 100

Next TopicJava Class





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA