What is the purpose of garbage collection in java, and when is it used?



What is the purpose of garbage collection in java, and when is it used?..

Answer / Kum Anshu Gupta

"Garbage Collection (GC) in Java is a feature that automatically frees memory by removing objects that are no longer needed. It is used to manage memory efficiently and prevent potential OutOfMemoryErrors during program execution. GC is triggered when the JVM determines that memory usage exceeds a certain threshold."n

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What are the two ways of implementing multi-threading in java?

2 Answers  


Explain about arraylist?

1 Answers  


Any one can explain how the inerface uses in java. give with example.

1 Answers   IBM,


What is difference between path and classpath variables?

1 Answers  


whats is inheritance?

15 Answers   CTS, HCL,


Is Java is 100% pure OOPS? Explain?

27 Answers   ANZ,


What is an exception? difference between Checked and Unchecked exception in Java

1 Answers   SkillGun Technologies,


What is Recursion Function?

1 Answers   iNautix,


Define how does a try statement determine which catch clause should be used to handle an exception?

1 Answers  


What is a java string?

1 Answers  


What is the map interface in java programming?

1 Answers  


What is meant by inheritance and what are its advantages?

1 Answers  


Categories