全屏
Java BufferedReader.close()方法实例
BufferedReader中的BufferedReader.close()方法具有以下语法。public void close() throws IOException
示例
在下面的代码中展示了如何使用BufferedReader.close()方法。import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
InputStream is = new FileInputStream("c:/test.txt");
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
br.close();
// creates error
br.read();
}
}
分享到:
0评论