About Question com.enthuware.ets.scjp.v6.2.414 :
Posted: Sun Dec 26, 2010 10:09 pm
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.
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.