kyoto dreams
Wednesday, January 11, 2006
  Swapper Consider the code below. What is the output.


public class Swapper {
public static void main(String[] args) {
Integer n1 = new Integer(26);
Integer n2 = new Integer(39);

System.out.println(n1);
System.out.println(n2);

swap(n1, n2);

System.out.println(n1);
System.out.println(n2);
}

static void swap(Object o1, Object o2) {
Object tmp = o1;

o1 = o2;

o2 = tmp;
}
}
 
Comments: Post a Comment

<< Home

ARCHIVES
May 2005 / June 2005 / August 2005 / January 2006 / March 2006 /


Powered by Blogger