【其它】以下代码输出结果为: class intWrap { int x;} public class Main { public static void main(String[] args) { intWrap i = new intWrap(); i.x = 10; intWrap j = new intWrap(); j.x = 20; swap(i, j); System.out.println("i.x = " + i.x + ", j.x = " + j.x); } public static void swap(intWrap i, intWrap j) { int temp = i.x; i.x = j.x; j.x = temp; }}
【其它】以下代码输出结果为: class intWrap { int x;} public class Main { public static void main(String[] args) { intWrap i = new intWrap(); i.x = 10; intWrap j = new intWrap(); j.x = 20; swap(i, j); System.out.println("i.x = " + i.x + ", j.x = " + j.x); } public static void swap(intWrap i, intWrap j) { int temp = i.x; i.x = j.x; j.x = temp; }}
发布时间:2024-11-28 13:58:40