Why the output is not same ??

Posted by javatechi on Stack Overflow See other posts from Stack Overflow or by javatechi
Published on 2010-04-06T05:21:15Z Indexed on 2010/04/06 5:23 UTC
Read the original article Hit count: 273

Filed under:
|
|
|

public class swapex{
public static int var1, var2;

public void badSwap(int var1, int var2){
int temp = var1;
this.var1 = var2;
this.var2 = temp;
System.out.println("var1 " + var1 + " var2 "+ var2);
}

public static void main(String args[]) {

swapex sw= new swapex();
sw.badSwap(10,20);
System.out.println("var1 " + var1 + " var2 "+ var2);
}
}

© Stack Overflow or respective owner

Related posts about java

Related posts about swap