This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
The term "static polymorphism" has been used to refer to overloading. "static" here means that the decision about which method to call is made when the program is compiled. This is in contrast to "dynamic polymorphism", what you get from overriding methods in Java, in which that decision is deferred until runtime.
But some people -- myself included -- dislike this term "static polymorphism," and prefer to use "polymorphism," without qualification, to mean runtime binding of method calls. The term "overloaded methods" is just fine for overloaded methods, which aren't, IMO, an object-oriented concept.
polymorphism and overloading are different concepts, not comparable...
SCJP 5.0 - 98% (2007)<br />SCWCD 1.4 - 97% (2007)
Joined: Oct 20, 2005
Hi Friedman, Thnx for posting me a detailed solution but i have one doubt regarding overloading in the enduser perspective...
generally our understanding is that in overloading , which method is to be called is decided during compile time... but we are passing the values to these overloaded methods during runtime. depending on the values that we give at runtime the proper method will be invoked...
this sounds like dynamic polymorphism as the method to be invoked is decided during the runtime depending upon the values we pass.
I disagree. Overloading is nothing more than a fa�on de parler. I can image Java without overloading -- there would have to be a bit of tweaking to admit multiple constructors, and it would be a bit of a pain if a latter version of JComponent introduced a method whose name clashed with one you had introduced in your custom subclass... but by and large Java would be the same. Now image Java without overriding: it's life, but not as we know it.
ps. I've been waiting years to drop fa�on de parler into conversation .
Originally posted by Jon Lee: polymorphism and overloading are different concepts, not comparable...
Polymorphism is often used as a synonym for runtime polymorphism, but historically it actually is a much broader concept, and includes overloading. Search for polymorphism on wikipedia.org (or stupid forum software doesn't allow me to post the link here because of some special characters... :roll: ) [ December 09, 2005: Message edited by: Ilja Preuss ]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus