Hello I had a problem. there is a question? Is overloading an example/type of Polymorphism? i have tried a simulator (jxam) & the options were: 1) overloading 2) overriding 2,3 & 4 th options were not correct , I have checked overriding but the answer was overloading. Also, i have study in the notes of Velmurugan of it that Overloading is an example of Poly. What is the truth? Plz help , its urgent Marium
polymorphism means "many forms". Overloading definitely is an example of (static) polymorphism, as one function can take many form. But, overriding is also dynamic polymorphism AFAIK. But I have seen notes saying that *only* overloading is polymorphism, which beats me. I suggest you post this to "Programmer Certfication Study" forum, you are most likely to get correct answer there. - Manish
I did little research (google of course!!!). Overriding is polymorphism, in fact more so compared to overloading, which is also known as ad hoc polymorphism. Here's the link - http://www.cs.olemiss.edu/~hcc/softArch/notes/budd12.html But then, if you have to choose only one as a correct answer, which one you'll choose? I'll go for overriding. - Manish
HI, Overriding replaces the overridden method from the superclass with another method with the same argument signature and return type. That is, it's a new method that is using the skeleton of the old method - you can even use part of the old method by calling super() Overloading on the other hand is a completely new method that uses the same name - with different argument signature and possibly return type - for the programmers convenience. There is no connection between the two methods.
Hope that helps,
------------------ Terry Doyle Sun Certified Programmer for Java 2 Platform
Well there is some debate about the terminology. In my opinion, if there is no late binding (as in over-riding) it is NOT polymorphism. But not everyone shares that definition. Here is a debate that we had some time ago on that very subject: http://www.javaranch.com/ubb/Forum24/HTML/009465.html
"JavaRanch, where the deer and the Certified play" - David O'Meara