Java Class isAnnotation() Method

The isAnnotation() method of java Class class returns true if this Class object represents an annotation type. Here, we must notice that if this method returns true, isInterface() would also return true, as all annotation types are also interfaces.

Syntax

Parameter

NA

Returns

true, if this class object represents an annotation type; false otherwise.

Throws

NA

Example 1

Test it Now

Output:

Check isAnnotation  ::: true
Check isInterface    ::: true

Example 2

Test it Now

Output:

Check isAnnotation   ::: false
Check isInterface    ::: true

Next TopicJava Class




Latest Courses