[Java] 纯文本查看 复制代码 import java.io.*;
public class Demo149 {
public static void main(String[] args) {
Father father=new Father();
father.test1();
}
}
class Father{
private Son son=null;
public Father(){
son=new Son();
}
public void test1(){
System.out.println("1");
try {
son.test2();
} catch (Exception e) {
System.out.println("Father在处理Son的异常");
e.printStackTrace();
}
}
}
class Son{
public void test2() throws Exception{//throws Exception抛出程序块的异常,由调用者解决异常
FileReader fr=null;
fr=new FileReader("d:\\aaa.txt");
}
}
|