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"!
Confusion in Question
Moderator: admin
-
- Posts: 1
- Joined: Wed Dec 04, 2013 7:49 am
- Contact:
Confusion in Question
Last edited by admin on Sun Dec 08, 2013 9:59 pm, edited 1 time in total.
Reason: removed qid reference from title
Reason: removed qid reference from title
-
- Site Admin
- Posts: 10068
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.924 :
I see that the correct answer is indeed specified as "In Object".
-Paul.
-Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 136 guests