This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Integer... and int... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Integer... and int..." Watch "Integer... and int..." New topic
Author

Integer... and int...

Alina Petra
Greenhorn

Joined: Oct 17, 2006
Posts: 26
If a class has the following two overloaded methods:



The compiler complains about the ambiguous method when one tries to call method(1).

Could anyone explain why?
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
Why overloading a varargs method doesn't work for the primitive type and its object wrapper type?
anil kuchana
Ranch Hand

Joined: Sep 08, 2000
Posts: 404
the point is using varargs is same as passing an array, just it hides the process..
in the above code the compiler just sees two arrays which are not more specific than other..
[ October 25, 2006: Message edited by: anil kuchana ]

http://www.skillfox.com Home of Java Skills SCJP 5.0, SCBCD, SCEA mock exams
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Integer... and int...
 
Similar Threads
Var args question...
AutoBoxing
BETA: Method resolving, un/boxing varargs mock question
wrapper class
Overloading Ambiguously