When is an object in the mean to garbage collection?
Answers were Sorted based on User's Feedback
Answer / chandrarekha
whenever the object goes out of scope or when it is no
longer being referenced, in such cases it can be a garbage
object. Garbage collection is implicitly invoked whenever
resources have to be allocated to the new objects that are
created and approach to detect a garbage object can be done
through reference-counting collectors,tracing
collectors,compacting collectors. The garbage collectors
can also be explicitly invoked by gc() supported by JVM
which is in the java.lang package
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sathya
When the object is no longer referenced, its eligible for
Garbage Collection
| Is This Answer Correct ? | 0 Yes | 1 No |
What are virtual functions?
How to Create A Wapper Class in core Java and Why are Use in java?
Explain when classnotfoundexception will be raised ?
What is the difference between method and means?
How to make a write-only class in java?
class A { private int i; } class B extends A { private int i; } if I create an object of B class what will be the memory of that object.
Is string a class in java?
Explain the relationship between the Canvas and Graphics class?
What are different types of arrays?
I have a String s = java; What is the output when I say s.replaceAll('j', 'k'); Also what is the value of s after replacing?
Can we instantiate interface in java?
What are the classes of java?