Sun Microsystem added the features like
annotation to make the development easier and
more efficient in jdk 5. The main objective to
develop the annotations is to make the
development easier. Annotations behaves like
the meta. The literal meaning of meta data is
data about data. Java also signifies this
meaning. Annotations are like meta data, means
you are free to add your code and can also
apply them to variables, parameters, fields type
declarations, methods and constructors.
Metadata is also used to create the
documentation to perform rudimentary compile
time checking and even for tracking down the
dependencies in code. XDoclet contains all these
features and is widely used. Annotations provide
a means of indicating about methods, classes,
dependencies, incompleteness and also about
the references on other methods and classes
respectively. Quoting from Suns official site,
It (annotation-based development) lets us
avoid writing boilerplate code under many
circumstances by enabling tools to generate it
from annotations in the source code. This leads
to a declarative programming style where the
programmer says what should be done and
tools emit the code to do it.

Annotation is the way of associating the
program elements with the meta tags so that
the compiler can extract program behavior to
support the annotated elements to generate
interdependent code when necessary.

Fundamentals of annotations

While going through the annotations you
should consider two things. The first one is
the annotation itself and second one is the
annotations types. An annotation is the
meta tag, used to give some life to the code
you are using. While annotation type is used
to define annotations so that you can use them
while creating your own custom annotations.
An annotation type definition appends an at
@ sign at the start of the interface keyword
with the annotation name. On the other hand,
an annotation includes the at @ sign followed
by the annotation type. You can also add the

data within the parenthesis after the annotation
name. Lets illustrate the concept more clearly
by using some examples.

This type of elements provide only single value.
It means that these can be represented with
the data and value pair or we can use the
shortcut syntax (just by using the value only
within the parenthesis).