Mega Code Archive

 
Categories / Java Tutorial / Language
 

Creating Annotations

Annotation is created based on the interface. Adding '@' before the keyword interface to declare an annotation type. All annotations consist only method declarations. These methods act much like fields. Our first annotation type: // A simple annotation type. @interface MyAnnotation {   String stringValue();   int intValue(); }