Dear sir ,
Attached here is a question from
java ranch mock exam which i had a problem with.I was under the impression that the bits wrap around (that is why 5>>32 gives 5 only & 5>>33(ie.33%32=1)is the same as 5>>1).What i am having a problem understanding is that,how does the value remain the same after shifting 32 bits(the size of an int).As mentioned in the mock exam the answer is (b).But,if the bits are gone then how is the same value retained after shifting 32 bits .Pls let me know .Thanks.
Java Ranch Mock Exam Question :
********************************
(#205)When using the right shift operator(>>),what happens to the bits which move off the right end ?
(a)They wrap around
(b)They'e gone
(c)They are added to result