Junior
What is the purpose of the Garbage Collector in Java?
sobes.tech AI
Answer from AI
Garbage collection in Java automatically manages memory. It finds objects that are no longer used by the program (which have no active references) and frees the memory they occupy. This prevents memory leaks and simplifies development, as the programmer does not need to manually free memory, as in C++.