This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Overloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Overloading" Watch "Overloading" New topic
Author

Overloading

venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
Hi ,I mam trying to compile this code &

i dont understand why its giving a comile time saying reference to met() is ambiguous.Doesnt compiler understand that 12 is in int so e.met(12) should call met(int a) in superclass

Also the same code works fine if we overload met() in class E

I dont understand how cum this code works now when methods are overloaded. Somebody please explain.


(added tags)
[ November 27, 2006: Message edited by: Barry Gaunt ]
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
I'm not getting a compile-time error on the first code.
Satish Kota
Ranch Hand

Joined: Feb 08, 2006
Posts: 88
Originally posted by venkatesh pendharkar:

i dont understand why its giving a comile time saying reference to met() is ambiguous.

Venkatesh,
The 1st code compiles fine here. I dont get any error. I get an output of 144 for both the cases.


SCJP 5.0 77%
venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
how is this possible??i am trying the same code on jdk 1.4 & its giving me reference to met() is ambigous error.
 
Consider Paul's rocket mass heater.
 
subject: Overloading
 
Similar Threads
Referring a Local Inner Class
Strange code
exam qs- object orientation- help!
I don't understand the result of this question, could somebody please explain me?