11.7
今天练习异常处理
下面是代码部分:
package lianxi;
import javax.swing.*;
public class bo {
public static void main(String[] args) {
try
{
System.out.println("in main");
throw new Exception("Exception is thrown in main");
//System.exit(0);
}
catch(Exception e)
{
System.out.println(e.getMessage());
System.exit(0);
}
finally
{
System.out.println("in finally");
}
}
}
运行结果: