Question:
Is it possible to preserve an object from garbage
collection (to live as long as the applet)?
Answer:
Yes, it is possible to preserve an object from garbage collection and
live as long as an applet. To do this you merely have to create a member
variable in the applet that references the object you want to preserve.
So long as the applet lives, it will maintain a reference to the object,
which will prevent the garbage collector from reclaiming the object.
However, as soon as the applet dies and no other object references the
applet, then both the applet and the object in question will become
eligible for garbage collection. Usually the browser runtime will maintain
a special reference to an applet while it is active, preventing it from
being garbage collected.