75.Java异常处理机制-手动抛出异常

 1 package testDate;
 2 import java.io.File;
 3 import java.io.FileNotFoundException;
 4 public class TestReadFile {
 5     public static void main(String[] args) {
 6         File f=new File("d:/b.txt");
 7         if(!f.exists()){
 8             try{
 9                 //手动抛出异常
10                 throw new FileNotFoundException("File can't be found !");
11             }catch(FileNotFoundException e){
12                 e.printStackTrace();
13             }
14         }
15     }
16 }

原文地址:https://www.cnblogs.com/shixinzei/p/8004849.html