Fork me on GitHub

try{}catch(){}//根据异常信息使用不同的方法要怎么实现

 1   
 2 
 3 try{
 4 
 5 }catch(Exception e){
 6 if(e.getMessage().contains("123456798")) //使用e.getMessage().contains("")表示你获取的报错信息中包含哪些内容就进行if操作
 7 {
 8 
 9 }
10 else{
11 e.printStackTrace();//否则直接输出异常信息
12 }
13 }

 

posted @ 2015-11-07 19:32  ZZZZW  阅读(525)  评论(0编辑  收藏  举报
AmazingCounters.com