首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

think in java4 中,<<<处理byte short char的解释 ,解决立即给分

2012-03-19 
think in java4 中,处理byte short char的解释在线等,解决立即给分Shifts can be combined with the eq

think in java4 中,<<<处理byte short char的解释 在线等,解决立即给分
Shifts can be combined with the equal sign (<<= or >>= or >>>=). The lvalue is replaced by 
the lvalue shifted by the rvalue. There is a problem, however, with the unsigned right shift 
combined with assignment. If you use it with byte or short, you don’t get the correct results. 
Instead, these are promoted to int and right shifted, but then truncated as they are assigned
back into their variables, so you get -1 in those cases. The following example demonstrates 
this:  

红色部分怎么理解?谢谢

[解决办法]
运算的时候提升为int,运算结束赋值的时候又把高位截掉了.
[解决办法]
高位是 左边.. 右边是低位.

热点排行