• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do I need to know the primitive data type's ranges for OCAJP?

 
Anjuthan Johann
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm currently preparing for OCAJP. I'm reading the book by Kathy Seirra. In the book it is said we do not need to know the details of calculating the ranges for current exam. But in another place it is mentioned we need to know that the primitive data types are signed and how that affect the ranges. I'm confused what we actually need to know for the exam? Should I need to know the highest value that a short can store and so?
 
travis thompson
Greenhorn
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Sybex book said that you do not need to memorize the specific min/max values of the primitives.

I think you do need to know the default value of each primitive. for example float = 0.0, int = 0
 
Narayana Bojja
Ranch Hand
Posts: 130
4
Hibernate Java Spring
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anjuthan Johann,

Should I need to know the highest value that a short can store and so?

You no need to know highest value of any data type . But know the range of  byte data type. I have seen some examples testing byte data type range. So know the byte data type range. No need to know other data type ranges.
For questions on  primitives , Focus on the below areas.
1. Is it  possible to assign one data type value to another data type.
2. When explicit type casting is required ?
3. When explicit type casting is not  required ?
4. Default values of each primitive data type .
5. Know the smallest data type to largest data type. I mean byte is the smallest  data type like that, know the order.

Hope it helps !
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3817
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The min/max values of primitives is not mentioned explicitly in the objectives but knowing them (at least byte, char, short, and int) is quite fundamental. Concepts such as why some assignments are valid and why some are not depend on that. For example, you can memorize the fact that a short and char cannot be assigned to each other without an cast class while both can be assigned to an int without any cast. But why is that so?  What will happen if you cast a short to char and then back to short?

The point is even if this is not mentioned in the objectives, it is imperative that you know them. The objectives cannot explicitly mention everything and if you try to stick to them very strictly, you will have spotty conceptual knowledge, which will be harmful for you not just in the exam but also during interviews and on the job.

HTH,
Paul.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to know the range anymore. (You used to on the exam for older versions of Java. That's why some docs still mention it).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic