aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Regading Byte.MAX_VALUE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Regading Byte.MAX_VALUE " Watch "Regading Byte.MAX_VALUE " New topic
Author

Regading Byte.MAX_VALUE

Chandra Sekhar
Ranch Hand

Joined: Sep 26, 2003
Posts: 90
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"
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
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


SCJP2. Please Indent your code using UBB Code
 
 
subject: Regading Byte.MAX_VALUE