exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 203 discussion

Actual exam question from Oracle's 1z0-819
Question #: 203
Topic #: 1
[All 1z0-819 Questions]

Given:



Which statement is true?

  • A. The code compiles successfully.
  • B. The code fails to compile as MyResource must implement Closeable.
  • C. The code fails to compile as try-with-resource needs a variable declaration such as MyResource r1 = res1; MyResource r2 = res2;.
  • D. The code fails to compile as res2 should be declared as final.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
cathDev
3 months, 3 weeks ago
Selected Answer: A
Tested A
upvoted 1 times
...
d7bb0b2
6 months, 2 weeks ago
A is correct cause, Class implement autoclosable and can variables declarated before try catch
upvoted 1 times
...
ASPushkin
6 months, 2 weeks ago
right answer is A //JDK 7 One one = new One(); // final One one = new One(); try (One temp = one; .....;) { //JDK9 One one = new One(); try(one) { and "one" is an effectively final
upvoted 2 times
d7bb0b2
6 months, 1 week ago
that is ok!
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago