Qyouu
1234567891011121314151617181920212223242526272829303132333435public class Point { private double x; private double y; public Point(double x, double y) { super(); this.x = x; this.y = y; } public double distance(Point point) { return Math.sqrt((point.x - this.x) * (point.x - this.x) + (point.y - this.y) * (point.y - this.y)); } public Point move(double x, double y) { return new Point(this.x + x, this.y + y); } @Override public String toString() { // TODO Auto-generated method stub return "(" + x + ", " + y + ")"; } public static void main(String[] args) { Point p1 = new Point(5, 6); Point p2 = new Point(-2, -9); System.out.println(p1.distance(p2)); System.out.println(p1.move(11, -2)); } }