I know that instanceof returns TRUE when an object is an instance of a particular class. For instance:
B extends A
C extends A
B b = new B();
C c = new C();
b instanceof A // returns TRUE
So far so good, so let's enter something that would seem like it should return false:
c instanceof B // won't compile (error: inconvertible types)
This doesn't compile, which makes sense because it allows an oversight to be caught at compile time. But, when DOES instanceof actually return false? It seems the only two options are TRUE and ERROR. The only exception I can think of is this:
null instanceof A // returns FALSE
But by the same logic as above, it would seem this should be caught at compile time as well.
What am I missing here? Are true / error the only practical options, or is it possible to actually return false in a more meaningful way, aside from when null is given as a reference variable?