exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 42 discussion

Actual exam question from Oracle's 1z0-819
Question #: 42
Topic #: 1
[All 1z0-819 Questions]

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 “”;
    }
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
5 months, 2 weeks ago
Selected Answer: A
You cannot use a null reference as a value for an element in an annotation. No parentheses on the date annotations cannot subclass one another, and an annotation is not allowed to extend/implement any interfaces
upvoted 1 times
...
[Removed]
1 year, 5 months ago
Selected Answer: A
A is correct
upvoted 1 times
...
Stavok
1 year, 6 months ago
Selected Answer: A
A. @interface Author { String name() default ""; String date(); } is a legal declaration of an annotation type. It defines an annotation type named Author with two elements: name and date. The name element has a default value of an empty string, while the date element has no default value.
upvoted 2 times
...
RP384
1 year, 11 months ago
Selected Answer: A
A is correct
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago