posted 19 years ago
Hi,
In this case implicit casting takes place. There are three conditions which should be satified for implicit casting to take place:
1) The source should be a "constant expression" of any type from byte, char, short and int.
2) The Destincation should be any type from byte, char and short.
3) And the value of the source is with in range at complie time.
Eg
final int i = 12;
byte b = i;
Will not give any compile time error. Whereas,
int i = 12;
byte b = i;
will give.
Hopefully this will solve ur problem.
Cheers~
Sharad