KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ExThrowTest2


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