You might wonder what happens to the memory that is allocated for a class instance when that class instance is no longer accessible. Such no-longer-accessible instances are created, for example, when variables are reassigned:
... movie m; <-- Declaration ... m = new movie(); <-- Assignment ... m = new movie(); <-- Reassignment; first class instance abandoned ...
The answer is that Java has built-in mechanisms that find the memory allocated for abandoned class instances. Inasmuch as those class instances cannot enter into any further computations, Java returns the memory to the free-storage list, making that memory available for the creation of new, useful class instances.
The process of returning abandoned memory to the free-storage list is called garbage collection.