table of Contents
Second, the classification of annotations
(2) Annotation with a parameter
(3) Notes with multiple parameters
1. Annotation concept
(1) JDK5 and later versions of JDK begin to support Java annotations;
(2) Java annotations (Annotation) are also called metadata , and exist in the code as " @ Note Name" , which is a special kind of annotation in the source code Markers can be used to mark codes such as classes, properties, methods, and parameters in the source code. They are mainly used to create documents, track dependencies in the code, and even perform basic compile-time checks.
Second, the classification of annotations
Java annotations are divided into three types according to whether they contain parameters:
(1) Without parameters
The grammatical structure is:
@Annotation
(2) Annotation with a parameter
The grammatical structure is:
@Annotation(parameter)
(3) Notes with multiple parameters
The grammatical structure is:
@Annotiation(parameter 1, parameter 2, parameter 3...)