posted 13 years ago
Hi all ,
Extract from Khaled Mughal:-
Implicit Narrowing conversions can occur when :-
1. The source is a constant expression of either byte,short,char or int .
2. The target type is either byte, short or char .
3. The value of the source is determined to be in the range of the target type at compile time .
Now in accordance to the above rules:-
int i2=-20; (1)
final int i3=i2; (2)
final int i4=200; (3)
short s3=(short) i2; (4)
char c3=(char) i3; (5)
(4) gives compiler error . I cant understand why ?