try…catch…finally例
public Integer add(Integer a, Integer b){
try {
System.out.println(“yyyy”);
return a + b;
} catch (Exception e) {
e.printStackTrace();
} finally {
System.out.println(“hello”);
}
return 0;
}
public static void main(String[] args) {
SysUser user = new SysUser();
Byte i = user.isDelete;
System.out.println("i:"+i);
Integer add = user.add(3, 4);
System.out.println("和:"+add);
}
控制台显示:
i:null
yyyy
hello
和:7