Online Java Compiler By
JavaTpoint.com
//import statements import java.io.Serializable; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedType; import java.lang.reflect.Type; import java.util.Arrays; public class ClassgetAnnotatedsuperclassExample1 { public static void main(String[] args) { AnnotatedType ann = MyThread1.class.getAnnotatedSuperclass(); System.out.println("Type Name : " + ann.getType().getTypeName()); System.out.println("Annotations : " + Arrays.toString(ann.getAnnotations())); //get the annotaions System.out.println("Declared Annotations: " + Arrays.toString(ann.getDeclaredAnnotations())); //get the declared annotations System.out.println("AnnotatedType class: " + ann.getClass().getName()); //get name of the class System.out.println("AnnotatedType class implementing interfaces: " + Arrays.toString(ann.getClass().getInterfaces())); } private static class MyThread1 extends Thread { MyThread1(){ System.out.println("MyThread1 Constructor 1 calling......"); } } }
Output