Skip to content

Types So Far

So far we have used four of the eight primitive Java data types.

  • int - integer data: 1, -95, 0
  • char - character data: 'a', '9', '!', '\t'
  • double - floating point data: 3.14, 0.0, -15.9997
  • boolean - a true or false value

In this chapter we will look at four more data types, and how Java stores them in memory.

  • byte - the smallest integer data type, with a very limited range of values.
  • short - a smaller version of int, with a smaller range of values.
  • long - a larger version of int, with a larger range of values.
  • float - a smaller version of double, with a smaller range of values.

primitive data type

A data type in Java that holds a simple data value, like a number or character. This is different than a reference, which holds the address of an object.


Prev -- Up -- Next