File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regading Byte.MAX_VALUE
 
Similar Threads
absolute function
Dan's Byte.MAX_VALUE question
How to predict the output for this type of Qs?
operator precedence and associativity
Question regarding Byte.MAX_VALUE