public class AWrongPointSwap {
    public static void wrongSwapPoints(AWrongPoint o1, AWrongPoint o2) {
        AWrongPoint aux = o1;
        o1 = o2;    // The assigned value is never used
        o2 = aux;   // The assigned value is never used
    }
    // References are passed by value
    // Como si estubiera pasando el numero de objeto
    // Como una copia de un puntero
    public static void SwapPoints(AWrongPoint o1, AWrongPoint o2) {
        double x = o1.getX();
        double y = o1.getY();
        o1.setX(o2.getX());
        o1.setY(o2.getY());
        o2.setX(x);
        o2.setY(y);
    }
    public static void main(String[] args) {
        AWrongPoint o1 = new AWrongPoint(7,1);
        AWrongPoint o2 = new AWrongPoint(0,2);
        System.out.println("o1 = " + o1 + ", o2 = " + o2);
        wrongSwapPoints(o1, o2);
        System.out.println("Wrong Swap:");
        System.out.println("o1 = " + o1 + ", o2 = " + o2);
        SwapPoints(o1, o2);
        System.out.println("Right Swap:");
        System.out.println("o1 = " + o1 + ", o2 = " + o2);
    }
}
