It make sense to see close() method as non-core functionality of byte stream objects, This is the reason this method is placed in interface Closeable. One evidence is, class ByteArrayInputStream do not require close() operation.

public abstract class InputStream implements Closeable {}

public abstract class OutputStream implements Closeable, Flushable {}

As per the above definitions, my observation is, interface Closeable should not be implemented by abstract class InputStream/OutputStream, It has to be left by concrete sub-classes to implement it.

enter image description here Do you think my understanding is correct?

Related posts

Recent Viewed