Grokking Java Interview Questions
0% completed
How Garbage Collection Finds Unused Objects
Order 1002 has a field that refers to order 1004, and order 1004 has a field that refers back to order 1002. The program sets its own variables for both orders to null. Does the JVM keep these two objects, which still refer to each other, or may it delete them?
It may delete them. The answer depends on one test, which is whether the running program can still reach an object. The four questions cover this test, the places where it starts, the treatment of groups of objects, and the methods System.gc() and finalize().
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%