Mock tests, Interview questions, Tutorials and Tech news
 
 

Archive

Posts Tagged ‘annotation’

Custom Annotation in Java 5.0

June 3rd, 2010 fanand 5 comments

Overview

Previous versions of Java provided a limited and ad-hoc mechanism for annotating code through JavaDoc comments

Java 1.5 allows both runtime and compile-time processing of annotation data. Annotations are said to annotate a Java element. A good example is the @deprecated JavaDoc tag. The @deprecated tag is used for documentation purposes. This tag has no effect on the code it describes, but causes the compiler to produce warnings if any other code references the tagged element.

Annotations will also be used for compile-time checking such as to produce warnings and errors for different failure scenarios. An example of an annotation that is used at compile time is the new @Deprecated annotation, which acts the same as the old @deprecated JavaDoc tag.

How to define an Annotation?

Annotations are defined in following way: Read more…

Get Adobe Flash playerPlugin by wpburn.com wordpress themes