Variables - Teaching Tips
Draw memory maps to show that variables are assigned locations in memory and show how the values get changed. Be sure to point out the that primitive variable reserve space for the variable that contains a value (like a slider it always will have a value). Object variables reserve space for an object reference (which may not be pointing to any valid object yet: null). Object variables do not create objects. Constructors are used to create and initialize objects (or for String objects literals will do).
Use one box with a label on it for primitive variables. Use two boxes with the label on the object reference and a pointer or link to the other box which is the object.
Use different size cups to be variables and fill them up with water to show how they store a value. Add the values together in a cup and measure the result.
Link to this Page