package cn.zxg.Exception;
import java.io.FileReader;
import java.io.IOException;
/**
* 使用throws声明异常
*/
public class Test03 {
public static void main(String[] args)throws IOException{
readMyFile();
}
public static void readMyFile() throws IOException {
FileReader reader=null;
reader= new FileReader("D:\\a.txt");
char c1=(char)reader.read();
System.out.println(c1);
if(reader!=null){
reader.close();
}
}
}
java异常机制-----------throws
猜你喜欢
转载自www.cnblogs.com/zzzao/p/10909675.html
今日推荐
周排行