how exactly garbage collection take place?

Answers were Sorted based on User's Feedback



how exactly garbage collection take place? ..

Answer / niraj talukdar

Garbage Collection is an automated process in Java unlike C
and C++. It executes to wipe out those objects which no
longer are used in a program or stay idle for a very long
time. This to free memory space alloted to these
objects.However, it is not guaranteed that all the idle
objects wil be destroyed every time garbage collection
process gets executed.A user can also manually call the
garbage collection to take place by executing System.gc()
method.

Is This Answer Correct ?    3 Yes 0 No

how exactly garbage collection take place? ..

Answer / vijayakumar chinnasamy

Variable/object
1. is eligible for garbage collection when no object refers
to it.
2. Is eligible when its reference is set to null i.e
objName=null.
3. referred by method variables or local variables are
eligible for garbage collection when they go out of scope.

Is This Answer Correct ?    1 Yes 0 No

how exactly garbage collection take place? ..

Answer / vinay

Another way to call garbage collector :-
Runtime rt = Runtime.getRuntime();
rt.gc();

Is This Answer Correct ?    0 Yes 0 No

how exactly garbage collection take place? ..

Answer / devil

As in Java its happen automatically, but if you want to do
this force fully you can do this by the use of
keyword "finalize".

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More Core Java Interview Questions

What is a layout manager?

1 Answers  


What is the difference between && and & in java?

0 Answers  


Can a static class have a constructor?

0 Answers  


Can we restart a dead thread in java?

0 Answers  


What Is Pointer?

4 Answers  






What is the differnence between String Buffer and String builder despite having knowledge that String builder is faster than String Buffer and last one is threadsafe.please tell another important difference.

3 Answers   IBM,


What is slash r?

0 Answers  


What is constructor and virtual function?

5 Answers  


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?

8 Answers   KPIT,


if i have one string class then how can you achive this class functionality of this class?

3 Answers   Fidelity, iFlex,


what is request processor?

1 Answers   Virtusa,


what is main purpose of abstract class?

7 Answers  


Categories