Java Class getAnnotations() MethodThe getAnnotations() method of java Class class returns annotations that are present on this element. If there are no annotations present on this element, then it returns an array of length 0. The caller of this method can modify the returned array. SyntaxParameterNo parameter is passed. Returnsannotations present on this element ThrowsDoes not throw an exception. Example 1Test it NowOutput: Annotations not set Example 2Test it NowOutput: @Class.Demo3(str=Demo Annotation, val=100) Next TopicJava Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India