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

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.)

    Correct Answer: A, C

    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.

Discussion
ASPushkinOptions: AB

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

d7bb0b2Options: AB

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

d7bb0b2Options: AC

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