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

  1. import srd.math.*;
  2.  
  3. public class Test
  4. {
  5.     public static void main(String[] s)
  6.     {
  7.         // create two complex numbers and add them together
  8.         ComplexNumber c1 = new ComplexNumber(1.0, 2.0);
  9.         ComplexNumber c2 = new ComplexNumber(1.0, 0.0);
  10.         ComplexNumber cSumm = c1.Add(c2);
  11.  
  12.         // ComplexNumber.toString() converts complex into String
  13.         System.out.println(c1.toString() + " + " +
  14.                            c2.toString() + " = " +
  15.                            cSumm.toString());
  16.  
  17.     }
  18. }
  19.