Java Language Annotations Add multiple annotation values


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", "javadoc"})

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