← Quiz: Java Exception Handling: all 10 questions
Quiz: Java Exception Handling · Question 5 of 10
What does try-with-resources guarantee?
What does try-with-resources guarantee?
- A.No exceptions will occur
- B.Resources declared in try(...) are closed automatically
- C.The program runs faster
- D.finally is not allowed
Answer & explanation
Correct answer: Resources declared in try(...) are closed automatically
Anything implementing AutoCloseable declared in try(...) is closed at the end.
Can you get the rest right without peeking?
Take the timed Quiz: Java Exception Handling quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →