Given the declaration:
@inteface Resource {
String value() default “Customer1”;
}
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() default “Customer1”;
}
Examine this code fragment:
/* Loc1 */ class ProcessOrders { ... }
Which two annotations may be applied at Loc1 in the code fragment? (Choose two.)
Option A is correct because when there is only one element named 'value', the name can be omitted. Option C is correct because the default value can be omitted and the annotation can be used without passing any parameters. Options B and D are syntactically correct but redundant since 'value=' is implied when there is only one element named 'value'. Option E is incorrect because the syntax for single-element annotations does not use curly braces.
answer: ABC A) correct if there is just one element named value, then name can be omitted. B) correct C) correct default values can be omitted D) E) invalid syntax
No options can be selected, 3 are valid: A : cause only one elemente called value B : cause explicit value C: cause has default value then can used withot pass anything
ABC if anotation haved a other value and is not set by default for value an other field then is requierd especified the name of two elements