Hi All,
Following code is supposed to swap integer values..
but it is not happening
public class Swap {
public static void swap(Integer a, Integer b){
Integer tmp = new Integer(a.intValue());
a = b;
b = tmp;
System.out.println("A : "+ a + "B : "+b);
}
public static void main(String[] args) {
Integer a = new Integer(10);
Integer b = new Integer(20);
swap(a,b);
System.out.println("A : "+ a + "B : "+b);
}
}
WHY ?????
Thanks in Advance
Krishna