Hi, I am studying for the SCJP exam - and am having a problem with method matching boxing / var-arg / widening section.
I have 3 methods String id(int... x) String id(long... x) and String id(double... x)
these, basically should only identify that they have been called. - i.e. this method has been called with var-arg int/long/double.
the method is being called by.. System.out.println("id(b,b,b,b) = "+id(b,b,b,b)); where b is a byte.
when I compile, I get the error below reference to id is ambiguous, both method id(long...) in OverLoading and method id(double...) in OverLoading match.
What is going on - a byte should widen to an int before a long - and shouldnt widen to a double a long doesnt widen to a double - and a double doesnt widen to a long. - Boxing doesnt apply as the methods all deal with primitives.
the error is telling me that both methods are the same - but I dont understand how they are.
This is all compiling under java version "1.5.0_12" any help is appreciated.