Given the following class definitions, which expression identifiers whether the object referred to by obj was created by instantiating class B rather than classes A, C and D?
class A {}
class B extends A{}
class C extends B{}
class D extends A{}
Select all valid answers.
a). obj instanceof B
b). obj instanceof A && !(obj instanceof C )
c). obj instanceof B && !(obj instanceof C )
d). !(obj instanceof C | | obj instanceof D )
e). !(obj instanceof A) && !(obj instanceof C) && !(obj instanceof D)
The Answer is (c). But I think it should (a), (b), (c), (d).
Please explain for me. I really confused why not (a) (b), it's so clearly belong to A, and B.
Thank you
hanmeng
------------------