Type Variables

A variable is always of a type and is a storage location for that type:

  • A variable of a primitive type always holds a value of that exact type or a null reference.

  • A variable of a class type X can hold a null reference or a reference to an instance of class X or of any class that is a subclass of X.

  • A variable of an interface type can hold a null reference or a reference to any instance of any class that implements the interface.