Constructors This Keyword Garbage
Constructors This Keyword Garbage
Constructors This Keyword Garbage
S.REVATHI AP/CSE
Constructors in Java
the class.
Rules for creating Java constructor
Note: It is called constructor because it constructs the values at the time of object
constructor.
same name
Example
Java Garbage Collection
memory automatically.
performed automatically.
Advantage of Garbage Collection
It makes java memory efficient because garbage collector removes the
e=null;
e1=e2;//
now the first object referred by e1 is available for garbage collection
3) By anonymous object:
new Employee();
finalize() method
The finalize() method - Garbage Collector always calls just before the
deletion/destroying the object which is eligible for Garbage Collection
Closing the resources associated with that object like Database Connection,
Network Connection or we can say resource de-allocation.
Once the finalize method completes immediately Garbage Collector destroy that
object.
Syntax:
here