App9_IOException

来源:互联网 发布:商品期货交易软件下载 编辑:程序博客网 时间:2024/04/29 09:39
import java.io.*;public class App {public static void main(String[] args) {FileInputStream in = null;try {in = new FileInputStream("theFileIsNotExist.txt");int b;b = in.read();while (b != -1) {System.out.print((char) b);b = in.read();}} catch (FileNotFoundException e) { // 小范围的Exception在前面e.printStackTrace(); // 打印堆栈信息} catch (IOException e) {System.out.println(e.getMessage());} finally {try {in.close();} catch (IOException e) {e.printStackTrace();}}}}

0 0
原创粉丝点击