Java Data Types

There are two types of data in Java. Primitive data have no sub-components, while objects do.

Later we shall see that objects are useful for representing complex things in the real world. For example, we might represent a student as an object that has sub-components for representing the student�s name, address, and GPA.

Java Primitive Types

Java has two types of inexact numbers:

float (32 bits) <: double (64 bits)

(Read the relationship S <: T as members of type S can be substituted for members of type T.)

Java has four types of exact numbers:

byte (8 bits) <: short (16 bits) <: int (32 bits) <: long (64 bits)

Exact numbers can substitute for inexact numbers:

long <: float

Java has two types of text:

char (16 bit) <: String (n bit)

In addition true and false belong to the boolean type.

See http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html