java - How to delete a class object? -


this question has answer here:

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. assigning null 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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -