posted 19 years ago
When you perform a shift operation, both operands, the value to be shifted and the amount to shift it by, must be an int or a long.
{
Here in (b >>>4) b=-64 & 4 both needs to be an int or long
}
If they aren't, they are promoted (if they can be � if not, you end up with a compiler error).
{
since byte b=-64.....b is converted to int & shift operation is done then after...
}
The result of the operation is the type of the left hand operand, which will be an int or a long.
{
After shift operation the result is an int....
}
As neither of those types are assignable to a byte, It must cast it as a byte or the compiler will complain.
[ November 07, 2005: Message edited by: Purujit Saha ]