新手, 问个简单的问题
public class HelloWorld {
/**
* @param args
*/
public static void swap(String first, String second) {
String temp;
temp = first;
first = second;
second = temp;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
String i = "hello", j = "world";
System.out.print("Hello world!");
System.out.print(i + " " + j);
swap(i, j);
System.out.print(i + " " + j);
}
}
为啥程序运行后, 最后一个out.pring应该输出world hello, 可是为什么还是hello world呢? 错在哪里? 请指教, 谢谢