• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data Types

 
rashid khokhar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We know that when we use small numbers then we use small data types like short or byte and for larg number we use long or others but i read in a book "type(byte,short,int,.....) determines behavior not size" pls explain.
------------------
 
Bob Lancaster
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by rashid khokhar:
We know that when we use small numbers then we use small data types like short or byte and for larg number we use long or others but i read in a book "type(byte,short,int,.....) determines behavior not size" pls explain.

The type determines the number of bytes allocated in the memory, and the range of possible values. The number 17 could be a byte, short, int or long. The value 75000 could only be an int or long.
A better explaination could be found in Chapter 1 of RHE.
I have noticed that the answers to most, if not all, of your questions could be found in The Complete Java 2 Certification Study Guide by Roberts, Heller and Ernest. If you do not have this book, buy it. If you are studying for the SCJP and/or the SCJD exam, the book is worth its weight in gold.
-Bob Lancaster
SCJP working on SCJD
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic