Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
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
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Programmer Certification (OCPJP)
Method overloading with var-args
Gaurav Sahu
Greenhorn
Posts: 9
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Can anybody explain why the call to the method go is not ambiguous ??
class Low { static String go(Integer x, Integer y) { return "low"; } static String go(int...x) { return "hi"; } public static void main(String args[]) { System.out.println(go(5,6)); System.out.println(go(5,6)); } }
[Added code tags - see
UseCodeTags
for details]
Helen Ma
Ranch Hand
Posts: 451
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Any overloading method with var-args is always the loser , according to KB.
So, in your case, go (int ...x) won't be chosen.
You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
int to string conversion using toStirng()
Calling static method from main
Question on widening ,boxing
BETA: Method resolving, un/boxing varargs mock question
static method can be inherited?
More...