Types of Variables
Recall that the type of a variable determines the types of values that can be stored in the variable.
A type t variable can contain type t objects.
Room r = new Room(); // LEGAL!
Account act = new Acount(); // LEGAL!
A type t variable may not contain objects of type t’ if t and t’ are unrelated types.
// Room r = new Account(); NOT LEGAL!
// Account act = new Room(); NOT LEGAL!