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 are singleton services?

0 Answers  


Explain the difference between jdk, jre, and jvm?

0 Answers  


Explain the concept of proper inheritance?

0 Answers   Thomson Reuters, Virtusa,


Why vector class is used?

0 Answers  


What are recursive functions?

0 Answers  






What does three dots mean in java?

0 Answers  


which method throws exception of type Throwable

2 Answers  


My application URL : http://localhost:8080/Application/Login.jsp. When a user enter this url in IE then, how it get Login.JSP Page exactly? what are the processes will happen from when we submit the URL to get Login.jsp?

3 Answers   IBM, TCS,


What is static variable with example?

0 Answers  


how many ways to create Thread and which one is good? runnable interface ot Thread class?

3 Answers   Satyam,


Is ResultSet class?

5 Answers   Bally Technologies, TCS,


Why we use methods in java?

0 Answers  


Categories