To create Custom Annotation in JAVA, @interface keyword is used. The annotation contains : 1. Retention : @Retention ( RetentionPolicy . RUNTIME ) It specifies that annotation should be available at runtime. 2. Target : @Target ({ ElementType . METHOD }) It specifies that the annotation can only be applied to method. The target cane be modified to: @Target ({ ElementType . TYPE }) for class level annotation @Target ({ ElementType . FIELD }) for field level annotation @Retention ( RetentionPolicy . RUNTIME ) @Target ({ ElementType . FIELD }) public @ interface CustomAnnotation { String value () default "default value" ; } value attribute is defined with @ CustomAnnotation annotation. If you want to use the attribute in annotation. A single attribute value. Example : public class Books { @CustomAnnotation(value = "myBook") public void updateBookDetail() { ...