Why annotations?
Generally we use annotation to facilitate the development and to make the code more clear and clean.
What are annotations?
Java 5 annotations provide standardization of metadata in a general goal. This metadata associated with Java features can be exploited in the compilation or execution.
Java was modified to allow the implementation of annotations:
Where can annotations be used?
Annotations can be used with :
packages, classes, interfaces, constructors, methods, fields, parameters, variables or annotations themselves.
Categories of annotation
There are three categories of annotation:
For example @Deprecated
, @Override
...
For example @MyAnnotation ( "test")
For example @MyAnnotation (arg1 = "test 3", arg2 = "test 2", arg3 = "test3")
Like we see before you can create your own annotation