public class Position { private final int x; private final int y; public Position(int x, int y) { this.x = x; this.y = y; } public int getX(){ return this.x; } public int getY(){ return this.y; } public Position translate(int dx, int dy){ return new Position(this.x + dx, this.y + dy); } double distance(Position other) { return Math.sqrt(Math.pow(this.x - other.x, 2) + Math.pow(this.y - other.y, 2)); } boolean istGleichZu(Position other) { return this.x==other.x && this.y==other.y; } }