Source of Point.java


  1: //Point.java
  2: 
  3: import java.io.*;
  4: 
  5: public class Point implements Serializable
  6: {
  7:   //Create a point from its coordinates
  8:   public Point(double xVal, double yVal)
  9:   {
 10:      x = xVal;
 11:      y = yVal;
 12:   }
 13: 
 14:   //Create a point from another point
 15:   public Point(Point point)
 16:   {
 17:      x = point.x;
 18:      y = point.y;
 19:   }
 20: 
 21:   //Convert a point to a string
 22:   public String toString()
 23:   {
 24:      return x+","+y;
 25:   }
 26: 
 27:   //Coordinates of the point
 28:   protected double x;
 29:   protected double y;
 30: }