Java Language Add multiple annotation values


Example

An Annotation parameter can accept multiple values if it is defined as an array. For example the standard annotation @SuppressWarnings is defined like this:

public @interface SuppressWarnings {
    String[] value();
}

The value parameter is an array of Strings. You can set multiple values by using a notation similar to Array initializers:

@SuppressWarnings({"unused"})
@SuppressWarnings({"unused", "javadoc"})

If you only need to set a single value, the brackets can be omitted:

@SuppressWarnings("unused")