exam questions

Exam 1z0-829 All Questions

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

Exam 1z0-829 topic 1 question 46 discussion

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

Given:

Which two modifications enable the code to print Open Close?

  • A. Replace line n1 with:
    class Folder extends Closeable {
  • B. Replace line n1 with:
    class Folder implements AutoCloseable {
  • C. At line n2, insert:
  • D. Replace line n1 with:
    class Folder extends Exception {
  • E. At line n2, insert:
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
SrinivasJasti
2 weeks, 1 day ago
Selected Answer: B
B & C are correct ---->The two key modifications that enable the code to print "Open Close" are: Implement AutoCloseable in the Folder class. Override the close() method in the Folder class.
upvoted 1 times
...
xplorerpj
6 months, 3 weeks ago
Selected Answer: B
B & C are correct
upvoted 1 times
...
zuluitai
6 months, 4 weeks ago
B and C are correct.
upvoted 2 times
...
supersquax
11 months, 2 weeks ago
B and C correct. A is wrong cuz both Closeable and AutoCloseable are "interfaces", not classes. Therefore, the "implements" keyword must be used. D wrong. the fact that it is "final" and doesnt throw anything is fine, but it is missing the "public" keyword. trying to compile without "public" gives this error: "attempting to assign weaker access privileges; was public"
upvoted 3 times
...
Tojose
1 year ago
options B and C
upvoted 4 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