Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Java by (2.6k points)

What is the difference between >>> and >> operators in Java?

1 Answer

0 votes
by (46k points)
>> is arithmetic shift right, >>> is logical shift right.

In an arithmetic shift, the symbol bit is stretched to save the signedness of the number.

For example  -2 described in 8 bits would be 11111110 (because the most important bit has negative weight). Changing it right one-bit applying arithmetic shift would give you 11111111, or -1. Logical right shift, though, doesn't bother that the value could serve a signed number; it just moves everything to the right and fills in from the left with 0s. Changing our -2 right one bit applying logical shift would give 01111111.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.5k questions

29.9k answers

500 comments

99.1k users

Browse Categories

...