This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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.