Solved

Analyze the Following Code. Class Test

Question 3

Multiple Choice

Analyze the following code. class Test {
Public static void main(String[] args) {
Object x = new Integer(2) ;
System.out.println(x.toString() ) ;
}
}


A) The program has syntax errors because an Integer object is assigned to x.
B) When x.toString() is invoked, the toString() method in the Object class is used.
C) When x.toString() is invoked, the toString() method in the Integer class is used.
D) None of the above.

Correct Answer:

verifed

Verified

Related Questions