swaraj gupta wrote:Have a look at these points:
1> All the integer values are of type int by default.
2> Java does not support implicit narrowing of data types. (Compile time error otherwise)
3> But when a byte, short or char type variable is initialized with a "Constant Expression" and if the value is within the range of type concerned then ONLY implicit narrowing takes place.(Compile time error otherwise)
Swaraj, thanks for reply.
Considering the statement 3, I thought that the code below should compile because 10 can be narrowed to a byte.
when I make the assignment of
byte b = 10; the compile narrowed it.
tks