Amazon interview question

How is the Java garbage collector implemented?

Interview Answer

Anonymous

28 Oct 2010

Garbage collector in java is not in our control. The Java runtime handles that for us. As a general rule, Java clears up a memory location after no active references to that location are found. This is so that the memory management is not left to the user due to which manual errors can occur causing memory leaks.