• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Most specific method..

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Thanks for this wonderful forum...Its been so helpful to me, I have finally got the nerve to join it!!!

I found this program in a mock exam. Could someone please help me in understanding this logic...



I'm getting compiler error saying amethod is ambiguous in Parent & Child class. But if I swap the method types, ie., long in Parent & int in Child, then it executes fine & amethod in Child gets called. Why is this happening?
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm not sure where your problem might be. I copied the code just like it was presented and ran it on a 1.5 compiler and it seems to be working fine. Works fine with source -1.4 too ( like it should ). Are you sure that this is the right code where you are facing errors ?
 
Vidhya Praba
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mine is still 1.3!!! so, i'm downloading 1.4.2 to check it...But the similar question can be found in the overloading & overriding objectives in the following mock exam link..

http://www.geocities.com/sahirshah/applets/mocktest.html
 
Vidhya Praba
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, question# 4 in the topic 5. Overloading & Object orientation in the above link...
 
Vidhya Praba
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John,

U are right! problem is not in the program, but in the version!!!its executing fine in 1.4.2! stupid, stupid vidhya..........
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Vidhya P,"

Welcome to JavaRanch!

Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names, with a first and a last name.

You can edit your name here.

Thank you for your prompt attention, and enjoy the ranch!

-Marc
reply
    Bookmark Topic Watch Topic
  • New Topic