Question 1-1

In your own words, describe what distinguishes a class variable from an instance variable. (I'm not asking about how you distinguish them syntactically in Java --- I'm asking how their behavior is different.)

Solution

A class variable is at a fixed location in memory. There can only be one copy of it available at any time. An instance variable, on the other hand, is associated with each individual instance of the class.

Back to Review for Midterm 1