码迷,mamicode.com
首页 > 其他好文 > 详细

异常处理顺序try/catch/finally

时间:2018-07-03 22:28:25      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:reader   顺序   span   system   class   int   oid   asn   exception   

 

public class FinallyTest{
    public static void main(String a[]){
    System.out.println(test());
  }
  
  public int test(){
int i = 10;
    try{
      System.out.println();
    }catch(Exception e){
      System.out.println(i);
    }finally{
    }
  }
}


import java.io.*;


class Untitled {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String filePath = in.next();


try{
File file = new File(filePath);
InputStream fin = new FileInputStream(file);
BufferReader fbuffer = new FileBufferReader(file);
while(fbuffer.hasNextLine()){
System.out.println(fbuffer.nextLine());
}
}catch(Exception e){
System.out,println("文件不存在");
}finally{
}



}
}

 

 

异常处理顺序try/catch/finally

标签:reader   顺序   span   system   class   int   oid   asn   exception   

原文地址:https://www.cnblogs.com/wqff-biubiu/p/9260811.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!