package com.vinraj.custom; public @interface Documentation { } The only difference between an interface definition and that of an annotation is the presence of @ before the interface keyword. Now the annotation can have its own members. package com.vinraj.custom; public @interface Documentation { public String author(); public String version(); public String shortDescription(); public String[] reviews(); } Below are the general guidelines to be followed while defining annotations: Annotation declaration should start with an ‘at’ sign like @, following with an interface keyword,
Read full article from Java Custom Annotations | My Experiments with Technology
No comments:
Post a Comment