Class destructor

protected void finalize(){ super.finalize(); }

This class method is used by the garbage collector to clean his used resources *¹. Do it like this:

objectName = null;
Runtime r = Runtime.getRuntime();
r.gc();
r.runFinalization();


*¹ It’s important to use the super.finalize(); to delete all the things from the mother-Classes, and not only from the used subclass (in a inheritance case).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: