Chapter 3: Data Types


Primitive types


Java has two types of data types: Primitive Types and Reference Types.
Primitive types are passed to and from methods 'by value' which means that each time a primitive type is passed as argument, a new value is created on the stack.
Reference types are instances of classes (objects) and are handled later in this tutorial.

Java has eight primitive types:


boolean   - has a value of 'true' or 'false' and 'false' is the default value.
char      - a 16 bit unicode character.
byte      - a signed integer of 8 bits. Values range from -128 to 127.
short     - a signed integer of 16 bits. Values range from -32768 to 32767
int       - a signed integer of 32 bits. Values range from -2147483648 to 2147483647.
long      - a signed integer of 64 bits. Values range from -9223372036854775808 to 9223372036854775807.
float     - a floating point number of 32 bits. Values range from 1.4E-45 to 3.4028235E+38.
double    - a floating point number of 64 bits. Values range from 4.9E-324 to 1.7976931348623157E+308.

Previous     Next

Tutorial Home


Do you know your Java?
Take a Ten-Question-Java-Quiz!

Bookmark and Share




Need help with your Java code? It's secure and confidential.
This is how it works:
Send a detailed description of what you need help with, the more details the better. Also provide a deadline for when it has to be finished. More time means better chance of putting your request into the schedule.

If the request is serious you will shortly receive an email with the price, to which you have to respond if you accept.

Once you have accepted, the work will begin on developing your code by an experienced Java developer. When the code is finished a link to a secure payment will be sent to you.

The source code is then sent to you once the payment is completed.

IMPORTANT! The request needs to be very detailed, else it may be ignored.


Write your detailed request here:

E-mail address: