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




Latest Courses