Java Arena

Module 22

Primitive and reference variables

What a variable really holds. A primitive variable holds its value, while a variable of a class type holds a reference to an object. What that means for assigning one variable to another, for `==` and for method parameters, and the value `null`, which refers to no object at all, with the NullPointerException that comes from using it.

Steps

  1. Primitive variables
  2. Reference variables
  3. Values and references as parameters
  4. null and NullPointerException