Types of Variables

In this lesson, we will look at two broad categories of variables in Java.

In the last lesson, we saw how variables in Java have different types, e.g., int, boolean, etc. We can broadly classify these variable types, also called data types, into two categories:

  • Primitive data types
  • Reference data types

Primitive data types

The variables with primitive data types directly store the data, i.e., the primitive value is stored in memory reserved by a primitive variable. The primitive data type is ...