+ 1
What is the purpose of garbage collection in Java, and when it is used?
2 Answers
+ 3
Garbage collection is used if your program is taking up way too much memory. It deletes data, which won't be used anymore.
+ 3
In a low language like C, you have to require areas in memory and release them by hand, when you're done.
You'll have to mess around with pointers, and a lot of things can go wrong.
Higher languages like Java have this process automatized. The whole procedure of requiring and releasing the memory happens in the background without you even knowing.