Interfaces


  1. AutoCloseable and Flushable are part of which package?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Autocloseable is a part of java.lang; Flushable is a part of java.io.


  1. Does close() implicitly flush() the stream.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    close() closes the stream but it flushes it first.



  1. Which version of java added Flushable interface?









  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Flushable and Closeable interface are added in java SE 5.


  1. What is the use of Flushable interface?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Flushable interface provides flush() method which Flushes this stream by writing any buffered output to the underlying stream.



  1. What is the difference between AutoCloseable and Closeable?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Closeable extends AutoCloseable and both are interfaces. Closeable throws IOException and AutoCloseable throws Exception.