This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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.