class MyException extends Exception{ private int d...
class MyException extends Exception{ private int detail; MyException(int a ){ detail = a;} public String toString(){ return "MyException "+detail; } } public class ExceptionDemo{ public static void compute(int a) throws MyException { System.out.println("called compute("+a+")"); if(a<0 ) throw new myexception(a); system.out.println("normal exit"); } public static void main(string args[] ){ try{ compute(0 ); compute(-3 catch(myexception e system.out.println("caught "+e); 执行结果: ___________________>