-->
当前位置:首页 > 题库 > 正文内容

单选题:分析如下代码:

Luz3年前 (2021-05-10)题库701
分析如下代码: @[C](2)
```
public class Test {
public static void main(String[] args) {
System.out.println(xMethod(5, 500L));
}
public static int xMethod(int n, long l) {
System.out.println("int, long");
return n;
}
public static long xMethod(long n, long l) {
System.out.println("long, long");
return n;
}
}
```

A. 程序无法编译,因为编译器无法区分应调用哪个xmethod。
B. 程序运行正确但输出的不是5。
C. 程序输出
```
int, long
5
```
D. 程序输出
```
long, long
5
```




A.程序无法编译,因为编译器无法区分应调用哪个xmethod。
B.程序运行正确但输出的不是5。
C.程序输出
```
int, long
5
```
D.程序输出
```
long, long
5
```


答案:C

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。