java - How to delete a class object? -
this question has answer here:
- deleting object in java? 7 answers
i have object called countergui. creates gui. create in class, myprogram.
once myprogram creates countergui object, how delete object? if this:
countergui first = new countergui(); //displays gui first = null;
i thought setting object null delete (including gui), doesn't. how delete it?
i don't see how duplicate question, previous answers set null or new object, doesn't work here.
assuming countergui java.awt.window
, then:
the way make window disappear call
setvisible(false)
.the way disconnect entirely native windowing call
dispose()
.once window has been
disposed
, making unreachable (e.g. assigningnull
of variables reference it) make eligible garbage collection.
simply assigning null
while window
visible have no effect. visible window object connected various things prevent being garbage collected.
Comments
Post a Comment