干嘛的
直接看JDK7的流(运用了AutoCloseable)源码
public abstract class InputStream implements Closeable {
//实现Closeable接口中的close方法
public void close() throws IOException {}
}
public interface Closeable extends AutoCloseable {
public void close() throws IOException;
}
JDK7起,无需我们在finally中进行流的关闭,原因在此
try(ObjectInputStream ois = new ObjectInputStream();) {}