class Demo1
{
public static void function()//throws Exception需要把try里面的Exception进行抛出,否则编译失败。
{
try
{
throw new Exception();
}
finally
{
System.out.println("B");
}
}
public static void main(String[] args)
{
try
{
function();
System.out.println("A");
}
catch (Exception e)
{
System.out.println("C");
}
System.out.println("D");
}
}
//输出结果B C D |
|