wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes example of overloaded methods that the compiler can not resolve? 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 "example of overloaded methods that the compiler can not resolve?" Watch "example of overloaded methods that the compiler can not resolve?" New topic
Author

example of overloaded methods that the compiler can not resolve?

Rachel Glenn
Ranch Hand

Joined: Oct 24, 2012
Posts: 95
Can someone provide to me an example of overloaded methods that the compiler finds ambiguous and is unable to resolve?
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4240
    
    7

The trick is to have two arguments, where one is more specific in one method, and the other is more specific in the other. Try this, for example (I haven't tested it, but it should "work"):


The compiler is fine until you try to call the methods with arguments that could work for both.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: example of overloaded methods that the compiler can not resolve?
 
Similar Threads
Method invocations
A question about overloading functions
using static method in polymorphism
Sub-class confusion...I thought I understood
overloading static methods.