Which declaration of an annotation type is legal?

Which declaration of an annotation type is legal?
A. @interface Author {
String name() default “”;
String date();
}
B. @interface Author extends Serializable {
String name() default “”;
String date();
}
C. @interface Author {
String name() default null;
String date();
}
D. @interface Author {
String name();
String date;
}
E. @interface Author {
String name();
String date default “”;
}

Download Printable PDF. VALID exam to help you PASS.

One thought on “Which declaration of an annotation type is legal?

  1. A

    Note:
    String name() default null; //element value must be a constant expression, not null.
    String date; // “=” is expected
    String date default “”; //”=” is expected

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.