Hi Ranchers,
On page 148,Ch-3 ,Operators and assignment it is given that
byte b=27;
but only....,the compiler puts in the cast,the preceding code is identical to the following
byte b=(byte)27;
Now on page 149,last line
byte a=128;//byte can only hold up to 127
And continuing on Page 150,
We can fix it with the cast
byte a=(byte)128;
Ok..,i know that
byte b=27;
byte b=(byte)128;
will compile
but this will not
byte b=128;
but according to the first quote mentioned from k&b,as the book says,doing
byte b=128;
should also have an implicit cast like byte b=(byte)128; when
byte b=27;
is having an implicit cast.
and thus byte b=128; should also compile and run.
i know cast will not be needed in the range of the primitive but here
in the book they have not mentioned it???
Thanks,
Anand