1.

What is the difference between AutoCloseable and Closeable?(a) Closeable is an interface and AutoCloseable is a concrete class(b) Closeable throws IOException; AutoCloseable throws Exception(c) Closeable is a concept; AutoCloseable is an implementation(d) Closeable throws Exception; AutoCloseable throws IOExceptionI had been asked this question in homework.The doubt is from AutoCloseable, Closeable and Flushable Interfaces in section Session Management, JSP & API of Java

Answer»

The CORRECT option is (b) Closeable throws IOEXCEPTION; AUTOCLOSEABLE throws Exception

Explanation: Closeable extends AutoCloseable and both are INTERFACES. Closeable throws IOException and AutoCloseable throws Exception.



Discussion

No Comment Found

Related InterviewSolutions