Javatpoint Logo
Javatpoint Logo

Java Class isAnnotationPresent() Method

The isAnnotationPresent() method of java Class class returns true if an annotation for the specified type is present on this element, false otherwise.

Syntax

Parameter

annotationClass - the Class object corresponding to the annotation type

Returns

true if an annotation for the specified annotation type is present on this element.

Throws

NullPointerException

Example 1

Test it Now

Output:

Check isAnnotationPresent  :::   false

Example 2

Test it Now

Output:

Check isAnnotationPresent  :::   true

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