1 public class ExThrowTest2 { 2 3 public static void main(String [] args){ 4 ExThrowTest2 ett = new ExThrowTest2(); 5 try { 6 ett.run(8, 9); 7 } 8 catch(Throwable e){ 9 } 10 } 11 12 public void run(int x, int y) throws Throwable { 13 if (x < y) throw new Throwable ("x must be bigger then y"); 14 System.out.println("x - y: "+(x-y)); 15 } 16 17 public class MyException extends RuntimeException { 18 public MyException(String s){ 19 super(s); 20 } 21 } 22 } 23 | Popular Tags |