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.
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<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Joined: Nov 28, 2002
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 ! Rgds, Aparna.