Solved

Analyze the Following Code: Public Class Test

Question 7

Multiple Choice

Analyze the following code: 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) The program does not compile because the compiler cannot distinguish which xmethod to invoke.
B) The program runs fine but displays things other than 5.
C) The program displays long, long followed by 5.
D) The program displays int, long followed by 5.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents