2

Can anyone explain to me why this swap method doesn't swap two numbers?

public class Test {

public static void main(String[] arr) {
    int original1 = 5;
    int original2 = 10;
    swap(original1, original2);
    System.out.println(original1);
    System.out.println(original2);
}

static void swap(int a, int b){
    int temp = a;
    a=b;
    b=temp;
}}
JohnPix
  • 1,595
  • 21
  • 44

0 Answers0