aspose file tools*
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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overloading