Hello all, Please look at the given codes. Can anyone explain why the output is different? I know it has something to do with dynamic/ static binding. But can anyone please explain a bit. Doesn't it violates the core polymorphism principle? I thought Java is a OO language !
Which kind of method will be invoked is determined at compile-time based on parameters provided (overloading) - so at compile time you have signature of method that will be called. If there are more methods with same signature in class hierarchy (overriding) then which one of them will be called is determined at run-time based on actual type of instance.
and POOF! You're gone! But look, this tiny ad is still here: