This week's book giveaway is in the Spring forum.
We're giving away four copies of Java Persistence with Spring Data and Hibernate and have Cătălin Tudose on-line!
See this thread for details.
Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Jaworski mock - an example of polymorphism (overriding or overloading?)

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I found this one in Jaworski's mock exam.
Which is an example of polymorphism.
a. inner classes.
b. anonymous classes.
c. method overloading.
d. method overriding.
I picked d. But the answer is c. Could some one please help me with this.
Thanks.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
D) like you.
I think it's a typo in their answer.
JR
 
Rancher
Posts: 241
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would also say d. Overriding is what causes a polymorphism issue, not overloading.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also agree, and so I'll move this to Mock Exam Errata.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Method overloading is one of the ways that Java implements polymorphism.
Overridden methods allow Java to support run-time polymorphism.
ie. Overridden methods are another way that Java implements the "one interface, multiple methods" aspect of polymorphism.
this answer is according to my knowledge gained from a book called "The Complete Reference (JAVA2 third edition)"
please check pg.158(Overloading Methods) & pg.215(Overridden Methods)
if this is not the case then please give me a detailed explaination for this.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that both over-riding and overloading are forms of Polymorphism - "one interface, multiple implementations". But most of the OOP books claim that over-riding is the 'true polymorphism' as it allows runtime polymorphism.

Originally posted by VVed:
Method overloading is one of the ways that Java implements polymorphism.
Overridden methods allow Java to support run-time polymorphism.
ie. Overridden methods are another way that Java implements the "one interface, multiple methods" aspect of polymorphism.
this answer is according to my knowledge gained from a book called "The Complete Reference (JAVA2 third edition)"
please check pg.158(Overloading Methods) & pg.215(Overridden Methods)
if this is not the case then please give me a detailed explaination for this.


 
Fire me boy! Cool, soothing, shameless self promotion:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic