题目内容

Analyze the following code. public class Test {public static void main(String[] args){System.out.println(max(1, 2));} public static double max(int num1, double num2) {System.out.println("max(int, double) is invoked"); if (num1 > num2)return num1;elsereturn num2;} public static double max(double num1, int num2) {System.out.println("max(double, int) is invoked"); if (num1 > num2)return num1;elsereturn num2;} }

A. The program runs and prints 2 followed by "max(int, double)" is invoked.
B. The program runs and prints 2 followed by "max(double, int)" is invoked.
C. The program cannot compile because you cannot have the print statement in a non-void method.
D. The program cannot compile because the compiler cannot determine which max method should be invoked.

查看答案
更多问题

Analyze the following code: class Test { public static void main(String[] args) {System.out.println(xMethod((double)5));} public static int xMethod(int n) {System.out.println("int");return n;} public static long xMethod(long n) {System.out.println("long");return n;} }

A. The program displays int followed by 5.
B. The program displays long followed by 5.
C. The program runs fine but displays things other than 5.
D. The program does not compile.

网络中的时延通过由()、()、()和排队时延四个部分组成。

在高速链路(或高带宽链路)上,比特会传送得更快些。

A. 对
B. 错

传播时延取决于传输信道的介质材料和传输距离。

A. 对
B. 错

答案查题题库