up previous next contents
Next: Literals Up: Variables, constants, and keywords Previous: Variables, constants, and keywords   Contents

Primitive data types

  • Java has built-in "primitive" data types.
  • These primitives support integer, floating-point, boolean, and character values.
  • The primitive data types of Java are:

boolean either true or false
char 16-bit Unicode 1.1 character
byte 8-bit integer (signed)
short 16-bit integer (signed)
int 32-bit integer (signed)
long 64-bit integer (signed)
float 32-bit floating-point
double 64-bit floating-point

  • Samples:
      int i = 1;
      int age = 38;
      float balance = 1590.55;
      char a = 'a';
      boolean isTrue = true;
    


up previous next contents
Next: Literals Up: Variables, constants, and keywords Previous: Variables, constants, and keywords   Contents