public class Point { double x=0.0; double y=0.0; // right is positive, left is negative void moveRight(double howFar) { x += howFar; } void moveLeft(double howFar) { x -= howFar; } // up is positive, down is negative void moveUp(double howFar) { y += howFar; } void moveDown(double howFar) { y -= howFar; } public String toString() { return ( "Point(" + x + ", " + y + ")" ); } public static void main(String[] args) { Point p = new Point(); Point q = new Point(); Point p_alias = p; p.x = 12.4; p.y = 12.4; q.moveLeft(12.4); q.moveDown(12.4); p_alias.moveUp(5.0); System.out.println("p=" + p + " q=" + q + " p_alias=" + p_alias); } }