SCJP (77%)
Originally posted by Mike_Jeya:
Fine,
But, Why do we use these kind of assigning?
B b= new B();
A a =b;
SCJP (77%)
Originally posted by Mike_Jeya:
[QB]
How it is overriding in this case? - It isn't, its just adding new methods in the sub-class.
it's calling subclass methods? - Correct, without being over-ridden, the methods are inherited as they were in the super-class.
what is the difference between the both?(this and whatever I sent earlier)
The second example has calls to methodC and methodD removed, the methods being called now DO exist, so there is no compiler error.
QB]
SCJP (77%)
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Think of how dumb the average person is. Mathematically, half of them are EVEN DUMBER. Smart tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|