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.)
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.)
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.
for empty @Resource({})
Tested A D is ok
Are ok, value is requiered other opcion not pass this value
Tested: A and D.
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.
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")
E is incorrect=> must be pass a required value. D is valid => altougth pass a string "Customer1" for anotation that is valid not required {}.
A & D are correct
A and D