从main抛出异常
/** 时 代 J a v a 公 众 号 - nowjava.com **/ import java.io.FileInputStream; import java.io.FileNotFoundException; public class Main { public static void main(String[] args) throws FileNotFoundException { openFile("C:/test.txt"); } public static void openFile(String name) throws FileNotFoundException { FileInputStream f = new FileInputStream(name); } }