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 Doubt with compiler error about method matching 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 "Doubt with compiler error about method matching" Watch "Doubt with compiler error about method matching" New topic
Author

Doubt with compiler error about method matching

Ada Lopez
Greenhorn

Joined: Apr 14, 2011
Posts: 7
Hello friends!

I was studying K&B´s Overloading Made Hard section in Chapter 3.
There´s no problem with this code:


a
But then I wondered which one of these two would pick if they were overloaded and surprise!!! It gives a compiler error (ambiguous, both method match) and I don´t understand why the compiler can´t choose:



Please, anyone knows why?

Starting to blog my progress ... in Spanish, sorry.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Go through this topic. From the rules listed out by Anand, read the 4th rule...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ada Lopez
Greenhorn

Joined: Apr 14, 2011
Posts: 7
Thanks so much!! This is what I was looking for!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt with compiler error about method matching
 
Similar Threads
varargs and boxing
widening,boxing and var args??
Widening,Boxing and Var-Args Combined
Doubt on Method Overloading using Var-args
Overloading in Combination with Var-args