home *** CD-ROM | disk | FTP | other *** search
/ Learn Java Now / Learn_Java_Now_Microsoft_1996.iso / JavaNow / Code / Chap09 / MyClass / MyClass.java < prev    next >
Encoding:
Java Source  |  1996-08-01  |  874 b   |  31 lines

  1. import srd.math.*;
  2. import java.lang.Exception;
  3.  
  4. public class MyClass
  5. {
  6.     public static void main(String[] s)
  7.     {
  8.         try
  9.         {
  10.             ComplexNumber c = new ComplexNumber(4.0, 2.0);
  11.  
  12.             System.out.println(c.toString() + " / 2 = "
  13.                              + c.Divide(2.0).toString());
  14.  
  15.             System.out.println(c.toString() + " / 0 = "
  16.                              + c.Divide(0.0).toString());
  17.  
  18.             System.out.println(c.toString() + " / 4 = "
  19.                              + c.Divide(4.0).toString());
  20.         }
  21.         catch(Exception e)
  22.         {
  23.           System.out.println("Output from e.toString():");
  24.           System.out.println(e.toString());
  25.           System.out.println("\n");
  26.  
  27.           System.out.println("Output from e.printStackTrace():");
  28.           e.printStackTrace();        }
  29.     }
  30. }
  31.