Skip to content
CodeKruPro

try-with-resources

QuizMediumJava onlyAsked in: ISS STOXX

Which statements about try (Res a = ...; Res b = ...) { ... } are true? Pick all that apply.

  • The resource types must implement AutoCloseable
  • Resources are closed in reverse order: b, then a
  • If the body throws and close() also throws, the close exception is lost
  • A catch or finally block is optional

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in