Java Method getDeclaredAnotations() MethodThe 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. SyntaxParameterNo parameter is passed. ReturnsAn array of annotations present on this element No exception is thrown.Example 1Test it NowOutput: key: getFieldvalue value: getting field attribute Example 2Test it NowOutput: @DemointerfaceX1(str=Demo Annotation, val=100)
Next TopicJava Method Class
|