Java is a reflective language, meaning you can use some language features in code as if they're objects. An example of this is the
Class class.
Annotation is similar. All types that are declared using
@interface will automatically also implement the
Annotation interface. This interface is used in reflective code (such as annotation processors) to inspect code that was annotated some way.
For instance, if you have a class that contains a declaration like this:
You can write an annotation processor that looks like this: