Skip to content

Instantly share code, notes, and snippets.

@chingovan
Last active March 2, 2017 01:34
Show Gist options
  • Save chingovan/c13d66b44cccc891ac5d8d6830956a6c to your computer and use it in GitHub Desktop.
Save chingovan/c13d66b44cccc891ac5d8d6830956a6c to your computer and use it in GitHub Desktop.
public class SwapInt {
public static void swap(int a, int b) {
int temp = a;
a = b;
b = temp;
}
public static void main(String[] argv) {
int c = 1;
int d = 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