home *** CD-ROM | disk | FTP | other *** search
/ Borland JBuilder 6 / jbuilder6.iso / Documents / JAVA Programming / examples / 10 / ExceptionDemo.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-09-08  |  986 b   |  20 lines

  1. class ExceptionDemo {
  2.    static void compute(int var0) throws MyException {
  3.       System.out.println("called compute(" + var0 + ").");
  4.       if (var0 > 10) {
  5.          throw new MyException(var0);
  6.       } else {
  7.          System.out.println("normal exit.");
  8.       }
  9.    }
  10.  
  11.    public static void main(String[] var0) {
  12.       try {
  13.          compute(1);
  14.          compute(20);
  15.       } catch (MyException var2) {
  16.          System.out.println("caught" + var2);
  17.       }
  18.    }
  19. }
  20.