Page 1 of 1

Confusion in Question

Posted: Wed Dec 04, 2013 7:55 am
by ageoval
Hi!
Wanna tell you about the incorrect answer to the following question:

Consider the following class...

class TestClass{
void probe(Integer x) { System.out.println("In Integer"); } //2

void probe(Object x) { System.out.println("In Object"); } //3

void probe(Long x) { System.out.println("In Long"); } //4

public static void main(String[] args){
String a = "hello";
new TestClass().probe(a);
}
}
What will be printed?


It's obviously that the answer is: "In Object".
But etsviewer tells us that we are wrong and that: "It won't compile"!

Re: About Question enthuware.ocajp.i.v7.2.924 :

Posted: Wed Dec 04, 2013 8:21 am
by admin
I see that the correct answer is indeed specified as "In Object".

-Paul.