public class Point { private double x; private double y; public Point(double x, double y) { this.x = x; this.y = y; } public double getDistanceTo(Point p) { double dx = p.x - this.x; double dy = p.y - this.y; return Math.sqrt(dx * dx + dy * dy); } public String toString() { // return "(" + x + ", " + y + ")"; // Oder aehnlich wie printf auf 3 Kommastellen genau return "(" + String.format("%.3f", x) + ", " + String.format("%.3f", y) + ")"; } }