The below mentioned source is from Whizlabs
SCJP 6.0 preparation kit.
The output is
Inside SubCovariantTest
true
5
Now, can anyone help in figuring out why line 2 is printing true?
As getObject() method of SubCovariantTest class is getting invoked and return type from that method is an object of type B, in my opinion line 2 should print false.
I know the compiler knows
Java better than me. But, I need to know the reason behind such results.