OOPS in JAVA 9
Garbage Collection
In Java destruction of object from memory is done automatically by the JVM. When there is no reference to an object, then that object is assumed to be no longer needed and the memory occupied by the object are released. This technique is called Garbage Collection. This is accomplished by the JVM.
Unlike C++ there is no explicit need to destroy object.
Advantages of Garbage Collection:
Programmer doesn't need to worry about dereferencing an object.
It is done automatically by JVM.
Increases memory efficiency and decreases the chances for memory leak.