posted 21 years ago
hi all,
but looking at this snippet
byte b=(int)16.2;
byte b1=(short)16.2;
byte b2=(char)16.2;
what can be inferred ??
is it first explicit casting and then implicit downcasting ???
i'm confused when it will work and when not??
here is something that i found relevant
According to R & H, the reason that they compile is that the right hand value is implicitly downcasted to the appropiate type before assignment. R & H says this only works for integral types (char, byte, short, int) and that it only works if it is just an assignment not an expression. (page 65, 2nd ed.).
need more info