标签:row extend extends imp nal 接口 原因 try exce
直接看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();) {}
标签:row extend extends imp nal 接口 原因 try exce
原文地址:https://www.cnblogs.com/Zhongzz/p/10364475.html