Morgan Stanley Interview Question
Financial Software DevelopersCountry: United States
Interview Type: In-Person
When a reference variable pointing to an object, is not accessible by an external tread, then the object is eligible for garbage collection.
Some times even an object have a reference variable, but that reference variable is not accessible, is considered to be eligible for garbage collection. This scenario is known as Isolation of a Reference.
When an object is eligible for garbage collection, JVM calls finalize() method on that object.
Whenever nothing is referring to object, then automatic garbage collector is called to finish off the mess.
That's not correct, It should be "when an object is not reachable, it will be collected". Think about A referring to B, but they are alone.
I think we should mention mark , mark and sweep,
- prasanna.nethra May 15, 2012the three memory segments (for new objects, long lived objects and middle age objects ) needs to be mentioned