I dont think its the right answer.... >>> is unsigned right hift operator
Post by:Chandra Bhatt
I would like to know the correct answer. How >>> operator works. Although it is not on the exam (310-055).
>>> Shift right, filling with zeros from left;
Post by:Tina Tibrewal
byte b = -42; // 1101 0110 int result = b >>> 4; // 268435453
It is instructive to compare the value of the expression (-42 >>> 4) with that of the expression (-42 >> 4), which has the value -3. The byte value for b, after unary numeric promotion to int, is shifted right with zero-fill four places.
But in the asked question since we are using an assigment operator the casting is done by the operator implicitly so 0111 1111 1111 1111 1111 1111 1111 1001 the higher order bits are dropped and what results is 1111 1001 which is -7.
I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database