Hi,
I got this error while compilation if any one of (1) or (2) were uncommented
saying that
reference to method is ambiguous both method method (java.io.IoException) in testing and
method method(java.lang.Integer) in testing match tc.method(null);
But, i am surprised how this java.io.IoException and java.lang.Integer are related .
can anybody please explain me ?
thanks in advance.
public class testing
{
public void method(java.lang.Object o)
{
System.out.println("Object Version");
}
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read.
You can edit your post by using the button.
AshutoshP Patil
Ranch Hand
Joined: May 04, 2010
Posts: 32
posted
0
hi, amit thanks for the reply . My doubt is i have overloaded method() with two argument types one with java.io.IOException and Integer. But, why the compiler thinks that its a ambigous method declaration resulting compilation fail
Because it's ambiguous: the compiler has no way of knowing which method should be called for a "null" parameter, because either method can take a "null" as input.