intermediateJVM & GC401 of 436

What is a memory leak in Java if Garbage Collection is automatic?

Tests whether you know a Java 'leak' isn't about forgetting to free memory -- it's an object staying reachable from a GC root (a static collection, a forgotten listener, an unclosed resource) long after it's logically done, so GC correctly refuses to collect it.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

← Back to all Core Java questions