What is Annotation? Annotations are nothing but meta-data added to the Java Elements. Annotations define a java type exactly similar to Classes,Enums,Interfaces and they can be applied to several Java Elements. How Custom Annotation are created? Annotation is defined using @ along with interface keyword .There are two meta annotations required to create custom annotationas shown in example below. @Target(ElementType.CLASS) @Retention(RetentionPolicy.CLASS) } The Meta-Annotations that would be covered in the forthcoming sections are, Target Annotation @Target:
Read full article from Java Interview Questions: Annotations
No comments:
Post a Comment