• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help needed on MAX_VALUE and MIN_VALUE

 
Aparna Shatdarsanam
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1865
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you seen this tutorial?
Another tutorial that might be helpful is The Cat and Mouse Games with Bits.
 
Aparna Shatdarsanam
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic