Given:
and
Which two are valid usages of the annotation? (Choose two.)
Given:
and
Which two are valid usages of the annotation? (Choose two.)
In the annotation @Meal, the element 'mainCourse' is a required field as it does not have a default value. Therefore, every usage of @Meal must specify a value for 'mainCourse'. Option D is valid as it correctly includes 'mainCourse' in both annotations without duplicating the same value, thereby complying with the repeatable annotation requirement. Option E is also valid as it includes 'mainCourse' as well as 'starter' and 'dessert', satisfying all required elements.
D and E is correct, main curse not has a default value so when use anotation explicit mainCourse be
A. @Meal is missing a default value for the element 'mainCourse' B. element value must be a constant expression C. @Meal is missing a default value for the element 'mainCourse' D. BUILD SUCCESSFUL E. BUILD SUCCESSFUL
Hmm, I think it is DE since mainCourse variable need to be provided and I don't think it would accept null value
Why A is not correct ?
Because mainCourse is a required element.
Everytime we use @Meal we are required to define mainCourse as it is a required element. It doesnt matter that the class has another @Meal annotation having mainCourse you still have to include it whenever you use the annotation @Meal
D and E is correct answer
D and E is correct answer
D and E is the correct answer