The issue is the difference between method invocation conversion and assignment conversion.
Assignment conversion includes the narrowing primitive conversions.
Method invocation conversion doesn't include the narrowing primitive conversions. [ August 01, 2006: Message edited by: Keith Lynn ]
Joined: Feb 07, 2005
ok Ankur check code 2 method return x which is int but compile time constant hence it works. variable a is also int but compile time constant but it does not work there is compile time error at Line->10 why
The method invocation conversions specifically do not include the implicit narrowing of integer constants which is part of assignment conversion. The designers of the Java programming language felt that including these implicit narrowing conversions would add additional complexity to the overloaded method matching resolution process.