Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 69

Given the declaration:

@inteface Resource {

String[] value();

}

Examine this code fragment:

/* Loc1 */ class ProcessOrders { ... }

Which two annotations may be applied at Loc1 in the code fragment? (Choose two.)

    Correct Answer: A, D

    The @Resource annotation is defined to take an array of strings as its value. Option A, @Resource({“Customer1”, “Customer2”}), correctly uses an array of strings. Option D, @Resource(“Customer1”), is also valid because it implicitly creates a single-element array. The other options either do not provide the required array or use incorrect syntax.

Discussion
Mukes877Options: CE

for empty @Resource({})

mendjijetOptions: AD

Tested A D is ok

d7bb0b2Options: AD

Are ok, value is requiered other opcion not pass this value

OmnisumemOptions: AD

Tested: A and D.

StavokOptions: AE

The correct answers are A. @Resource({“Customer1”, “Customer2”}) and E. @Resource(). The @Resource annotation is defined to take an array of strings as its value. In option A, the annotation is applied with an array of two strings, which is a valid use of the annotation. In option E, the annotation is applied with an empty array, which is also a valid use of the annotation. Option D is incorrect because the value of the annotation must be an array of strings, not a single string.

[Removed]

D is correct. Actually any of these are correct. Last 2 only when 'value' is the only required element. @Resource(value={"String"}) @Resource(value="String") @Resource({"String"}) @Resource("String")

d7bb0b2

E is incorrect=> must be pass a required value. D is valid => altougth pass a string "Customer1" for anotation that is valid not required {}.

StavokOptions: AD

A & D are correct

xuancatOptions: AD

A and D