This week's book giveaway is in the JavaScript forum. We're giving away four copies of Getting MEAN with Mongo, Express, Angular, and Node and have Simon Holmes on-line! See this thread for details.

Hi, I've a doubt concerning the decrement operator. Could someone please explain the following to me: byte y = -128; byte x = y--; System.out.println ("y = " + y); Output: y = 127

I cant figure out how the value of y became 127. Thanks. Rebecca

y-- is equivalent to y = y - 1 that is y = -128 - 1 = -129 -128 = 1000 0000 -1 = 1111 1111 1000 0000 +1111 1111 ----------- 1 0111 1111 The leftmost bit is ignored, thus resulting 127

- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!