Analyze the following code:

class Test {
public static void main(String[] args) {
System.out.println(xmethod(5));
}

public static int xmethod(int n, long t) {
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 because the compiler cannot distinguish which xmethod to invoke.


b

Computer Science & Information Technology

You might also like to view...

(Enhancing Class Date) Modify the Date class of Figs. 9.22–9.23 to perform error checking on the initializer values for data members month, day and year. Also, provide a member function nextDay to increment the day by one. The Date object should always remain in a consistent state. Write a program that tests function nextDay in a loop that prints the date during each iteration to illustrate

that nextDay works correctly. Be sure to test the following cases: a) Incrementing into the next month. b) Incrementing into the next year.

Computer Science & Information Technology

When saving a workbook as a template, it is saved to the My Documents folder by default

Indicate whether the statement is true or false

Computer Science & Information Technology

COGNITIVE ASSESSMENT A perpetrator is using a botnet. Which of the following is the least likely use of his botnet?

A. sending spam via email B. spreading viruses C. committing a distributed denial of service attack D. authoring ActiveX scripts

Computer Science & Information Technology

In a Function procedure declaration, any lines of code after a Return statement will not be executed.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology