Originally posted by anushree ari:
...but if i compile sepreately -1>>>1,the result is
2147483647,why is that?
Yes, but if you cast that result to a byte then the result will be -1.
The compound assignment operator casts the result to the type of the left hand operand. If all of the 8 least significant bits are set to one then the result of a cast to a primitive byte is -1.