try catch finally return
public int f(){
try{
String demo=
null;
demo.split("a"
);
System.out.println("try"
);
}catch(Exception e){
System.out.println("catch"
);
}finally{
System.out.println("finally"
);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
haha a=
new haha();
a.f();
}
}
catch 不能独立于 try 存在。 在 try/catch 后面添加 finally 块并非强制性要求的。 try 代码后不能既没 catch 块也没 finally 块。 try, catch, finally 块之间不能添加任何代码
转载于:https://www.cnblogs.com/-strong/p/7086524.html
转载请注明原文地址: https://win8.8miu.com/read-1449993.html