1.

It is a good practise to not throw which exception in close() method of autocloseable?(a) IOException(b) CustomException(c) InterruptedException(d) CloseExceptionThis question was addressed to me during an online interview.My doubt stems from AutoCloseable, Closeable and Flushable Interfaces in portion Session Management, JSP & API of Java

Answer»

Correct OPTION is (c) InterruptedException

To explain I WOULD say: InterruptedException INTERACTS with a thread’s INTERRUPTED status and runtime misbehavior is likely to occur if an InterruptedException is suppressed.



Discussion

No Comment Found

Related InterviewSolutions