处理检查的异常
import java.io.FileInputStream;//from nowjava.com - 时 代 Java import java.io.FileNotFoundException; public class Main { public static void main(String[] args) { openFile("C:/test.txt"); } public static void openFile(String name) { try { FileInputStream f = new FileInputStream(name); } catch (FileNotFoundException e) { System.out.println("File not found."); } } }