Tony Docherty wrote:The reason passing a byte value doesn't work (whereas passing a long does work) was explained by Campbell earlier.
...it is said that bytes being smaller than long are more specific so the ambiguity can be sorted out.
Campbell Ritchie wrote:Passing a long to a byte is impossible, so that sorts out the ambiguity; bytes being smaller than longs are more specific, but only a byte can fit into a byte, so the ambiguity can be sorted out.
Tony Docherty wrote: When I added empty method bodies it compiled on my system - what version of Java are you using and can you show the whole compiler error message.
Test.java:13: reference to go is ambiguous, both method go(byte...) in Test and
method go(long...) in Test match
Campbell Ritchie wrote:Don’t know any more. Sorry. Have you tried casting a byte to a long? Does that compile at all?
These parameters make the method call ambiguous again even though the one with 'byte... x' is more specific.
Campbell Ritchie wrote:bytes being smaller than longs are more specific, but only a byte can fit into a byte, so the ambiguity can be sorted out.
I read it in a way which made me feel you were suggesting that I could just look up the answer in the JLS instead of asking. My Bad !
I hope that wasn't a taunt
There are about 7 hits if you open the Java Language Specification and use ctrl-F-“overload”