public static void swap(int num1, int num2){
      int temp = num1;
      num1 = num2;
      num2 = temp;
    }
    public static void main(String args[]) {
        int x1 = 5; int x2 = 7;
        swap(x1,x2); //<--Code is here
    }

    public static void swap(int num1, int num2){
      int temp = num1; //<--Code is here
      num1 = num2;
      num2 = temp;
    }
    public static void main(String args[]) {
        int x1 = 5; int x2 = 7;
        swap(x1,x2);
    }

    public static void swap(int num1, int num2){
      int temp = num1;
      num1 = num2;
      num2 = temp; //<--Code is here
    }
    public static void main(String args[]) {
        int x1 = 5; int x2 = 7;
        swap(x1,x2); 
    }

    public static void swap(int num1, int num2){
      int temp = num1;
      num1 = num2;
      num2 = temp;
    }
    public static void main(String args[]) {
        int x1 = 5; int x2 = 7;
        swap(x1,x2); //<--Code returns here
    }

    Point x1 = new Point(1,2); Point x2 = new Point(5,6);
    swap(x1,x2);

    public static void swap(Point p1, Point p2){
      Point temp = p1;  //CODE IS HERE
      p1 = p2;
      p2 = temp;                               }

    public static void swap(Point p1, Point p2){
      Point temp = p1;
      p1 = p2;
      p2 = temp;  //CODE IS HERE               }

    Point x1 = new Point(1,2); Point x2 = new Point(5,6);
    swap(x1,x2); //Method returns, no change in x1 or x2

    Point x1 = new Point(1,2); Point x2 = new Point(5,6);
    swap(x1,x2); //About to invoke swap

  public static void swap(Point p1, Point p2){
      Point temp = (Point)p1.clone(); //Deep Copy
      p1.x = p2.x; p1.y = p2.y;
      p2.x = temp.x; p2.y = temp.y;
  }

  public static void swap(Point p1, Point p2){
      Point temp = (Point)p1.clone(); //<-- This line Executed
      p1.x = p2.x; p1.y = p2.y;
      p2.x = temp.x; p2.y = temp.y;          
  }

  public static void swap(Point p1, Point p2){
      Point temp = (Point)p1.clone(); 
      p1.x = p2.x; p1.y = p2.y;  //<-- This line Executed
      p2.x = temp.x; p2.y = temp.y;
  }

  public static void swap(Point p1, Point p2){
      Point temp = (Point)p1.clone(); 
      p1.x = p2.x; p1.y = p2.y;
      p2.x = temp.x; p2.y = temp.y; //<-- This line Executed
  }

    Point x1 = new Point(1,2); Point x2 = new Point(5,6);
    swap(x1,x2); //Swap has returned