exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 19 discussion

Actual exam question from Oracle's 1z0-809
Question #: 26
Topic #: 2
[All 1z0-809 Questions]

Given:
final class Folder { //line n1
//line n2
public void open () {
System.out.print("Open");
}
}
public class Test {
public static void main (String [] args) throws Exception { try (Folder f = new Folder()) { f.open();
}
}
}
Open Close?
Which two modifications enable the code to print
line n1 with:

  • A. Replace class Folder implements AutoCloseable { line n1 with:
  • B. Replace class Folder extends Closeable { line n1 with:
  • C. Replace class Folder extends Exception {
  • D. At line n2, insert: final void close () { System.out.print("Close"); }
  • E. At line n2, insert: public void close () throws IOException { System.out.print("Close");
Show Suggested Answer Hide Answer
Suggested Answer: static.AC 🗳️

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
Innovation
Highly Voted 4 years, 6 months ago
A, E is correct D is wrong because we cannot reduce the visibility of the inherited method from AutoCloseable
upvoted 7 times
...
asdfjhfgjuaDCV
Most Recent 4 months, 1 week ago
A,D is the Correct answer In A,E error is coming: error: cannot find symbol public void close () throws IOException { ^ symbol: class IOException location: class Folder 1 error
upvoted 1 times
asdfjhfgjuaDCV
4 months, 1 week ago
AE is correct sorry for above
upvoted 1 times
...
...
steefaand
5 months, 1 week ago
Selected Answer: AE
A and E are correct.
upvoted 1 times
...
iSnover
5 months, 1 week ago
Selected Answer: AE
The answer is AE, tested.
upvoted 1 times
...
M_Jawad
4 years, 6 months ago
the answer is A and E
upvoted 4 times
...
adnano1234
4 years, 6 months ago
Answer: AD
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