Suppose we have the following definition.
interface Vessel{}
interface Toy{}
class Boat implements Vessel{}
class Speedboat extends Boat implements Toy{}
In main, we have these:
Boat b = new Speedboat();
and (b instanceof Toy)
evaluates to be true
? Why? My understanding is that the reference type of b
is Boat
, but Boat
has nothing to do with Toy
, so it should be false
but the answer is true
.