Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 99

Given:

and this code fragment:

What is the result?

    Correct Answer: C

    The correct answer is C. A compilation error occurs at line n1. In Java, resources that implement the AutoCloseable interface must be declared and initialized in the try-with-resources statement, which is not the case here. Instead, the resource res1 is being reassigned inside the try block, which causes a compilation error.

Discussion
AVB22Option: C

answer c, compilation error: Syntax error on token "res1", VariableDeclaratorId expected after this token

Svetleto13Option: C

C,tested

asdfjhfgjuaDCVOption: C

C is the correct answer

steefaandOption: C

Answer is C. Resource must be declared in try initialization block.

Kim514Option: C

Answer C. A compilation error occurs at line n1. Simply put, to be auto-closed, a resource has to be both declared and initialized inside the try:

HuimOption: B

Answer is B

Huim

sorry, answer is C