In java, garbage means unreferenced objects.
Garbage Collection is process of reclaiming the runtime unused memory
automatically.The Garbage collector of JVM collects only those objects that are
created by new keyword. So if you have created any object without new, you can
use finalize method to perform cleanup processing (destroying remaining
objects).
Advantage of Garbage Collection:
1 It makes java memory efficient because garbage collector removes the
unreferenced objects from heap memory.
2 It is automatically done by the garbage collector so we don't need to
make extra efforts.
Core Java Interview Questions
Object Oriented Programming(OOP) Questions and Answers
Collections Interview Questions
Java Exceptions Interview Questions
Java Threads Interview Questions
Collection framework in java interview questions
oops concepts with example in java
Java Serialization Interview Questions
Top 20 Core Java Interview Questions with Answers
String Interview Question in java With Example
synchronization interview questions
Java Reflection Interview question
Java Executor Framework (JDK 1.5) Interview Questions
JDK 1.7 interview Questations and Answers
Java I/O interview question with example