Java中异常处理
可以用 try-catch
捕获,也可以用 throw-throws
抛出
public void test2() {
try {
File f = new File("E://a.txt");
FileInputStream fis = new FileInputStream(f);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public void test() throws Exception {
throw new FileNotFoundException();
}