File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Help needed on MAX_VALUE and MIN_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 "Help needed on MAX_VALUE and MIN_VALUE" Watch "Help needed on MAX_VALUE and MIN_VALUE" New topic

Help needed on MAX_VALUE and MIN_VALUE

Aparna Shatdarsanam

Joined: Nov 28, 2002
Posts: 9
Can someone please explain me how to arrive at what MAX_VALU and MIN_VALUE for various data types hold ? For example how do I know what Char.MAX_VALUE holds ??? I have seen many questions regarding these on Dan's mocks. Am not able to fair very well with such kind of questions. Please help.
Rory French
Ranch Hand

Joined: Apr 03, 2003
Posts: 97
Type char is an unsigned primitive with the numeric range of 0 to 65535(2 to the power of 16, minus 1), so its minimum value will be 0 and its maximum value will be 65535. This can be verified using the wrapper class as follows:

The minimum and maximum values of the other primitive non-floating point numeric types (i.e. byte, short, int, long) are just as easy to determine based on their ranges, bearing in mind that they are all signed types.
Floating point primitive ranges are not as straightforward because their decimal precision is embedded in the bit representation of the floating point primitives, so their ranges arn't as obviously apparent as those of the other numeric primitives types.
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
Have you seen this tutorial?
Another tutorial that might be helpful is The Cat and Mouse Games with Bits.

Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="" target="_blank" rel="nofollow">Try my mock exam.</a>
Aparna Shatdarsanam

Joined: Nov 28, 2002
Posts: 9
Thanks Rory.
Thanks to u too Dan. The tutorial is of good help in understanding.
Am giving my exam the day after tomorrow. I have hugely depended on your mocks and I stumble on very simple and silly points. Hope I clear the exam with all the good wishes of the friendly ranchers. Good day !
I agree. Here's the link:
subject: Help needed on MAX_VALUE and MIN_VALUE
jQuery in Action, 3rd edition