intermediateJVM Internals & Memory384 of 436
What is garbage collection and how does it work? What is the purpose of finalize()?
Tests whether you describe GC as reachability analysis from GC roots (not simple reference counting, which can't handle cycles), and whether you flag finalize() as deprecated and unreliable -- it runs on no guaranteed schedule and modern code uses try-with-resources or Cleaner instead.
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