IllegalThreadStateException:非法改变线程状态,如启动已执行线程 ClassCastException:把对象A转换为对象B,且对象A不是对象B的同类或子类 举例: throw new IOException(“Cannot find the directory”); throw new MyException(); //自定义的异常类 void exam(int mark) throws OutofMarkException { 异常抛出 } //...
( ) public class Quiz2 { public static void main(String args[]) { try {throw new MyException(); }catch(Exception e) { System.out.println("It's caught!"); }finally{ System.out.println("It's finally caught!"); } } } class MyException extends Exception{} A.It's finally caught!