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 }

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

相关文章:

  • 2021-06-02
  • 2022-01-16
  • 2021-04-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-17
  • 2022-12-23
  • 2021-06-14
  • 2022-02-10
  • 2021-12-19
相关资源
相似解决方案