home *** CD-ROM | disk | FTP | other *** search
/ Learn Java Now / Learn_Java_Now_Microsoft_1996.iso / JavaNow / Code / Chap09 / BankAccount / test.java < prev   
Encoding:
Java Source  |  1996-06-20  |  577 b   |  24 lines

  1. import java.io.*;   // this includes the println() function
  2.  
  3. public class test
  4. {
  5.     public static void main(String[] s)
  6.     {
  7.         try
  8.         {
  9.               // open a bank account with $50 in it
  10.               BankAccount ba = new BankAccount(50.0);
  11.  
  12.               // now try to take out $100
  13.               ba.Withdrawal(100.0);
  14.  
  15.               System.out.println("Withdrawal successful!");
  16.         }
  17.         catch(Exception e)
  18.         {
  19.             // output exception's error message
  20.             System.out.println(e.toString());
  21.         }
  22.     }
  23. }
  24.