Can an unreachable object become reachable again?
Answers were Sorted based on User's Feedback
Yes, an unreachable object may become reachable again.This
happens when the object's finalize() method is invoked and
the objct performs an operation which causes it to become
accessible to reachable objects.
| Is This Answer Correct ? | 19 Yes | 1 No |
YES, Finalization is a feature of the Java programming
language that allows you to perform postmortem cleanup on
objects that the garbage collector has found to be
unreachable. It is typically used to reclaim native
resources associated with an object.
When the garbage collector determines that obj is
unreachable, it notices that obj is finalizable -- as it
had been recorded upon allocation -- and adds it to the
JVM's finalization queue. It also ensures that all objects
reachable from obj are retained, even if they are otherwise
unreachable, as they might be accessed by the finalizer.
So, we can say that it can be reachable.
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / ravikiran(aptech mumbai)
yes an unreachable object may become reachable once it get a
reference befre garbage collection especially in finalize()
method call
| Is This Answer Correct ? | 5 Yes | 0 No |
I want to re-reach and use an object once it has been garbage collected. Define how it’s possible?
Can you declare a static variable in a method?
What is the difference between static (class) method and instance method?
what is the difference between the "protected and default" modifiers?
Write a program to print fibonacci series up to count 10.
How do you create a method in java?
difference between String a; and String a=new String();? y do v need to assign memory to the variable?
Why chararray() is preferred over string to store the password?
Is string is a keyword in java?
What do negative exponents mean?
What is the default value of local and global variables?
Which is the best way to use for String concatenation in Java?