Skip to content

Instantly share code, notes, and snippets.

@chingovan
Created March 2, 2017 01:37
Show Gist options
  • Save chingovan/c19cb97b310c3bdc63f99292d63a9184 to your computer and use it in GitHub Desktop.
Save chingovan/c19cb97b310c3bdc63f99292d63a9184 to your computer and use it in GitHub Desktop.
/**
* Created by ChiNV on 3/2/2017.
*/
public class SwapPoint {
public static void swap(Point a, Point b) {
Point temp = a;
a = b;
b = temp;
}
public static void main(String[] argv) {
Point c = new Point(1);
Point d = new Point(2);
System.out.println("c: " + c);
System.out.println("d: " + d);
swap(c, d);
System.out.println("c: " + c);
System.out.println("d: " + d);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment