Junior — Middle
Who in Java is responsible for memory management and garbage collection?
sobes.tech AI
Answer from AI
In Java, memory management and garbage collection are performed by the JVM (Java Virtual Machine). Specifically, the Garbage Collector (GC) is responsible for automatically cleaning up unused objects.
The Garbage Collector tracks objects that are no longer referenced and frees the memory they occupy, helping to prevent memory leaks and reducing the burden on developers for manual memory management.