Hi, What is the result of the following expression ? (byte) (Byte.MAX_VALUE + 1) == Byte.MIN_VALUE This will print true. Can some one help me to find the reason why it prints true. Regards Chandrasekhar S
"Luck is when opportunity meets preparation"
posted 12 years ago
Byte.MAX_VALUE is 127 , that is 0x7f Byte.MIN_VALUE is -128 , that is 0x80 0x7f + 1 = 0x80
A simple knowledge about binary, hexadecimal and two's complement is necessary for the exam. Read about them in the web or maybe just search in the Ranch