Originally posted by Peter Chase:
Gosh, what a silly exam question! They're not all like that, are they? ...
Thankfully, no. I wouldn't expect the real exam to be this poorly worded. This example has come up repeatedly in the
SCJP forum (where I'm moving this post).
In addition to the single-class issue (Dog IS-A Dog), also consider that an interface is not a class, but it
is a type.
So, for example, if Animal is an interface, and Dog is a class that implements Animal, then an instance of Dog IS-AN Animal (and instanceof will return true).