For the question: Which of the following statements is true?
The test said the correct answer was:
For any non-null reference o1, the expression (o1 instanceof Object) will always yield true.
I believe the correct answer is:
None of the above.
What if o1 was a primative? It won't compile...so it will not always yield true
I suppose if it's going to yield anything it would be true because in order for it to compile it would have to be an Object. My point is assuming it could be a primative, it will not always yield anything but a compiler error. Always is a big word.
I understand the point of the question and what concept it's testing but may I suggest that the question be revised to explain that o1 is not a primative or that it may yield true instead of always.
About Question com.enthuware.ets.scjp.v6.2.414 :
Moderator: admin
-
- Site Admin
- Posts: 10036
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.414 :
Hello,
If you have a statement like int o1 = 10; then yes, the given expression will not compile.
However, the question says "non null reference". In the above case (int o1 = 10; ) o1 is not a reference. A reference exists only for objects and not for primitives.
HTH,
Paul.
If you have a statement like int o1 = 10; then yes, the given expression will not compile.
However, the question says "non null reference". In the above case (int o1 = 10; ) o1 is not a reference. A reference exists only for objects and not for primitives.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: Bing [Bot] and 55 guests