Question: Given three classes A, B, and C, where B is a subclass of A, and C is a subclass of B, which one of these
Given three classes A, B, and C, where B is a subclass of A, and C is a subclass of B, which one of these boolean expressions is true only when the reference o refers to an object of class B, and not to an object of class A or class C?
Select the one correct answer.
(a) (o instanceof B) && (!(o instanceof A))
(b) (o instanceof B) && (!(o instanceof C))
(c) !((o instanceof A) || (o instanceof B))
(d) (o instanceof B)
(e) (o instanceof B) && !((o instanceof A) || (o instanceof C))
Step by Step Solution
3.40 Rating (150 Votes )
There are 3 Steps involved in it
b The expression o instanceof B will return true if the object referred to by o is of type B o... View full answer
Get step-by-step solutions from verified subject matter experts
