为什么在Java中有两个Right Shift运算符,而只有一个Left Shift运算符? [英] Why are there two Right Shift operators and only a single Left Shift operator in Java?
本文介绍了为什么在Java中有两个Right Shift运算符,而只有一个Left Shift运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Java的新手,并且知道Java >>
和>>>
中有两个Right Shift运算符,但是只有一个左移位运算符<<
.为什么会这样?
I am new to java, and came to know that there are two Right Shift operators in java >>
and >>>
, but only one left shift operator <<
. Why is it so?
推荐答案
因为逻辑和算术左移运算是相同的(来自维基百科).
Because logical and arithmetic left-shift operations are identical (from wikipedia).
请注意在两次向左移位时,符号位(最左位)会发生什么情况.
Notice what happens to sign bit (left-most bit) in both left shifts.
这篇关于为什么在Java中有两个Right Shift运算符,而只有一个Left Shift运算符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文