package trycatch;
/**
* 工作嘛,谈不上喜欢不喜欢,就是遇到问题拷贝黏贴下。
* 多了解点总是好的,多自己去动手。
*
* @author ZengWenFeng
*/
public class TryCatchFinallyDemo
{
public static int test()
{
int i = 1;
try
{
System.out.println("try : " + i);
return i / 0;
}
catch (Exception e)
{
i++;
System.out.println("catch : " + i);
e.printStackTrace();
}
finally
{
i++;
System.out.println("finally : " + i);
// return i;//测试用的
}
System.out.println("return : " + i);
return i;
}
public static void main(String[] args)
{
System.out.println(test());
}
}