Java - Java Data Types

What is a variable

A variable has three properties:

  • A memory location to hold the value
  • The type of the data stored at the memory location
  • An identifier to refer to the memory location

Java supports two kinds of data types:

  • Primitive data type
  • Reference data type

A variable of the primitive data type holds a value.

A variable of the reference data type holds the reference to an object in memory.

Related Topics