java.lang.Class.getAnnotations()


java.lang.Class.getAnnotations()

package com.codingdict;



import java.lang.annotation.Annotation;



public class ClassDemo {



   public static void main(String []args) {



      ClassDemo cls = new ClassDemo();

      Class c = cls.getClass();



      Annotation[] a = c.getAnnotations();

      if(a.length != 0) {

         for(Annotation val : a) {

            System.out.println(val.toString());

         }

      } else {

         System.out.println("Annotations is not present...");

      }

   }

}