Question: Which statement about the following declarations is correct? A. None of the declarations compile. B. Only the declaration of Friend contains a compiler error. C.
Which statement about the following declarations is correct?

A. None of the declarations compile.
B. Only the declaration of Friend contains a compiler error.
C. Only the declaration of MyFriends contains a compiler error.
D. Both declarations contain compiler errors.
E. None of the above.
import java.lang.annotation. *; import java.util.List; @Target (ElementType.TYPE_USE) public @interface Friend { String value (); String lastName () default null; int age = 10; } class My Friends { } void makeFriends () { var friends = List.of(new @Friend ("Olivia") Object(), new @Friend ("Adeline") String(), new @Friend ("Henry") MyFriends ()); }
Step by Step Solution
There are 3 Steps involved in it
The code snippet presents a custom Java annotation named Friend and a class MyFriends with a method ... View full answer
Get step-by-step solutions from verified subject matter experts
