Originally posted by Cathy Song:
Can someone explain line 1, 3 please? Thanks.
The byte and short are promoted to an int, made positive and compared to zero.
I would have thought that line 2 would have confused you more than line 1 and 3.
Line 2 is false because of this rule of the abs method:
Note that if the argument is equal to the value of Long.MIN_VALUE, the most negative representable long value, the result is that same value, which is negative.