Java -1.6 annotation features supports annotation which is mainly used to develop a simple Aspect Oriented programs. Apart from the primitive informations we can put more information on a class and on it's members using annotation.
Problem with Object Oriented Programming.
If you expose your interface in an object oriented model, then those clients who are using it need to understand your object model, they have to design their object , they may need to inherit your functionality. they may not have a loosely coupled design.
For example,
Lets take an example of any object oriented api like SAX parser, here you need to inherit some of the abstract class like ContentHandler to serialize/deserialize your objects to XML string.
So first, you start with some abstract definitions which will be tightly coupled to the java interface. What is the intention of you to do it ?, You want to generalize some thing on top of your design. This is good with respect to an Object Oriented Programming.
Thats why JAXB is introduced, You does not have to extend any interface on top of your design. you need only a POJO object with some of its member variables marked with annotation.
Lets take an example of Employee Object
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="employee" propOrder = {"name", "salary"})
public class Employee {
@XmlElement(name="name", required=true)
String name;
@XmlElement(name="salary", required=true)
double salary;
}
Now you can think of doing it without annotation by ContentHandler interface, it is very difficult.
Note: Recently all the java apis comes with annotation support, example like hibernate, JPA, EJB-3.0, Google GUICE, all Spring. Even Groovy script has annotation like structure.