Simple Data Types

Integers

byte      8-bit signed
short 16-bit signed
int 32-bit signed
long 64-bit signed

Floating-points

float    32-bit signed
double 64-bit signed
  • Floating-point math never throws an exception.
  • Dividing by 0 equals Inf.  // Infinity
  • Dividing by Inf equals 0.

Characters

char     16-bit unicode

Booleans

boolean  true and false (only two possible values)
  • Can't represent false as 0 or null.
  • Can't represent true as nonzero.
  • Can't cast from boolean to non-boolean, or vice versa.

Wrapper Classes

  • Integer, Long, Float, Double, Boolean, Character.
  • Can be used to convert values from one type to another.
  • Can be used to pass simple data types by reference.

Misc

  • Always uses the same amount of memory, regardless of compiler, processor, or platform.
  • Passed by value to methods.
  • Initialized by default to 0, null, or false.