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();

Continue reading “Class destructor”

Advertisements

What is overriding?

You can define different a method in a sub-class identical to one from the super-class. Then the object will execute the method according to his class . If doesn’t exits there, he will execute it from the super-class.

What is an Object?

An Object is an operative and unique copy of a class.

It’s like a normal variable (int, byte, char), it has his own attributes that you can edit and also has his own methods. All the changes (from attributes or methods) are made to the specified object, not to the class).

What is a Class?

A class is nothing by itself. It’s only an explanation of a new thing, like in a dictionary every word has his own definition.

It’s a mold and from where you can make a new Object.

Create a website or blog at WordPress.com

Up ↑