How to set String Array in Java Annotation

Do it like this:

public @interface CustomAnnot {

    String[] author() default "me";
    String description() default "";

}

And your annotation:

    @CustomAnnot(author={"author1","author2"}, description="test")

Leave a Comment