This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Vishal Hegde wrote:i just read polymorphism,overloading and overridding i felt that their functionalities are almost same ..
Overloading & overriding are two different things. Overloaded methods are resolved at compile time whereas overriden methods are resolved at the run time depending on the actual object being referenced. When you override a method you can have the advantage of polymorphic behavior.
polymorphism is just a term for that you can have a lot of forms for something:
if you have the classes: SomethingMobil, Car, Ferrari, Renault, Toyota, Truck, SomeTruckMark, AnotherTruckMark and so on, you want to say probably, that a truck and a car are kinds of SomethingMobil, also Toyota is a kind of SomethingMobil, but Toyota is also a kind of Car and so on. So you have a lot of forms of SomethingMobil and that thing describes the term polymorphism.
override is way to describe this behavior:
overloading is something else. It is just the way you can write the same methodname, but have a differend kind of parameters: