I have the following code:
public class Main {
    static void swap (Integer x, Integer y) {
        Integer t = x;
        x = y;
        y = t;
    }
    public static void main(String[] args) {
       Integer a = 1;
       Integer b = 2;
       swap(a, b);
       System.out.println("a=" + a + " b=" + b);
    } 
}
I expect it to print a=2 b=1, but it prints the opposite. So obviously the swap method doesn't swap a and b values. Why?
 
     
     
     
     
     
     
     
     
     
     
    