Advertisement
calcpage

APCS_CH8_PointTester.java

Feb 14th, 2013
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.75 KB | None | 0 0
  1. /*
  2. PointTester.java    MrG 2012.0208
  3. purpose: implement a Point class for Polygon.java!
  4. required files:     PointTester.java        main class
  5.             Point.java          derived class
  6. translator phase:   javac PointTester.java
  7. interpreter phase:  java PointTester
  8. */
  9.  
  10. public class PointTester
  11. {
  12.     public static void main(String[] args)
  13.     {
  14.         Point p1 = new Point(0,0);
  15.         Point p2 = new Point(2,2);
  16.         Point p3 = new Point(4,0);
  17.  
  18.         System.out.println("p1 = " + p1);
  19.         System.out.println("p2 = " + p2);
  20.         System.out.println("p3 = " + p3);
  21.         System.out.println("p3.getX() = " + p3.getX());
  22.         System.out.println("p3.getY() = " + p3.getY());
  23.  
  24.         if(p1.equals(p2))
  25.         {
  26.             System.out.println("p1==p2");
  27.         }
  28.         else
  29.         {
  30.             System.out.println("p1!=p2");
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement