Java Class getAnnotationsByType() MethodThe getAnnotationsByType() method of java Class class gets the annotation by type that is associated with this element. If no annotation is related to this element, it returns an array of length 0. SyntaxParameterannotationClass - the Class object corresponding to the annotation type ReturnsAssociated annotation type associated with this element, otherwise an array of length zero. ThrowsNullPointerException Example 1Test it NowOutput: [@java.lang.Deprecated()] Example 2Test it NowOutput: MySuperClass Constructor Executing... subClass Constructor Executing... [@java.lang.Deprecated()] [@ClassgetAnnotationsByteExample2$Annotation1()] 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