public class Point {
    public double x;
    public double y;
    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }
    // Mucho mas facil que en C. :-)
    // No hay "&", "*", "->": &r->p1.x
    public void invertCoordinates() {
        double aux = x; // x es implicitamente this.x
        x = y;
        y = aux;
    }
    @Override
    public String toString() {
        return "(" + x + "," + y + ")";
    }
}
