posted 23 years ago
Choice a only insures obj is an instance of B, but can't guarantee it's not instantiated by C, which is a subclass of B(and therefore "is a B".)
Only Choice C is Valid, because it insures that obj is NOT an instance of C, and therefore can only be instantiated by B in this case.
By the way, Here is the author's original explanation for this question in his book:
The important thing to remember is that if an object is an instance of a class, then it is also an instance of all the superclasses of this class.
[This message has been edited by Tom Tang (edited February 15, 2001).]
[This message has been edited by Tom Tang (edited February 15, 2001).]
Sun Certified Java Programmer