Javatpoint Logo
Javatpoint Logo

Java Method getDeclaredAnotations() Method

The getDeclaredAnnotations () method of Method class returns an array of annotations directly present on this element and ignores inherited annotations. If no annotations present on this element, the return value is an array of length 0. The caller of this method can modify the returned array.

Syntax

Parameter

No parameter is passed.

Returns

An array of annotations present on this element

No exception is thrown.

Example 1

Test it Now

Output:

key: getFieldvalue
value: getting field attribute

Example 2

Test it Now

Output:

@DemointerfaceX1(str=Demo Annotation, val=100)
Next TopicJava Method 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