首页 试题广场 > 试题详情
单选题

在Java中,运行如下代码段,则输出结果为( )。
public class Test {
public static void swap (int num1,int num2){
int temp=num1;
num1=num2;
num2=temp;
}
public static void main(String[] args) {
int n1=20;
int n2=30;
swap(n1,n2);
System.out.println(n1+ ", "+n2);
}
}

  • A.20,30
  • B.30,20
  • C.程序逻辑错误
  • D.程序编译错误
提交并查看答案
下一题 上一题
Ke星伙伴们的回答/ 248个回答
关闭
关闭
QQ
交流群
邀请
好友
App
下载
意见
反馈
返回
顶部