ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
What is garbage collection in Java, and how can it be used ?
 Question Submitted By :: Pranab Dutta
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 1
When a Java object becomes unreachable to the program, then 
it is subjected to garbage collection. The main use of  
garbage collection is to identify and discard objects that 
are no longer needed by a program so that their resources 
can be reclaimed and reused.
 
Is This Answer Correct ?    22 Yes 2 No
Pranab Dutta
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 2
When an object is no longer referred to by any 
variable,java automatically reclaims memory used by that 
object.This is known as garbage collection.
   System.gc() method may be used to call it explicitly.
 
Is This Answer Correct ?    24 Yes 2 No
Janet
 
 
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 3
Hi... 
GarbageCollector: Whenever an object is no longer used in 
the program at that time the garbage collector reclaims the 
memory of an object.It is controlled by the JVM ,The JVM 
runs periadically by using "mark" and "sweep"algorithms.
Instead of "destructor" in c++  , java supports garbage 
collector.
 
Is This Answer Correct ?    8 Yes 2 No
Devarathnam C,kotagudibanda(po
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 4
garbage collecton in java means, if a particular object in 
a program is not being refered since long time then it will 
be automatically deleted with the help of garbage collector 
so that some amount of memory is saved.we can explicitily 
call it by adding a method system.gc()in the program.so in 
this case there is no need to use'destructor'to destroy the 
objects.
 
Is This Answer Correct ?    8 Yes 2 No
Ms
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 5
When an object has of no use in a program then it has to be 
discarded to free the occupied space by it so that other 
object can fill the space.That is what Garbaghe collection 
is.
 
Is This Answer Correct ?    5 Yes 0 No
Veer
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 6
when we remove the object that it will be stored particular 
memory space these are known as garbage collection.

It is finalize method is used in the garbage collection.
 
Is This Answer Correct ?    4 Yes 1 No
Sangeetha
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 7
when ever object scope is over at that the object memory 
removed.This is nown as garbageCollection.
 
Is This Answer Correct ?    2 Yes 2 No
Dsr
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 8
garbage collection is process run thruogh out the java
programe ,when we  class creation takes place after that we
have to instantiate that class ,if we can not gives refrence
to this object then that will be find out by garbage
collector and that will collect by garbage collector.
 
Is This Answer Correct ?    2 Yes 0 No
Dhawal
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 9
when an object in memory is no longer refered by a variable,
the garbage collector automatically move it to garbage
collection.
instead of calling destructor JVM do it automatically, as we
use destructor in c++ to destroy the object.
 
Is This Answer Correct ?    1 Yes 0 No
Syed Sikandar Bakht
 
  Re: What is garbage collection in Java, and how can it be used ?
Answer
# 10
Garbage collection is a thread, that runs to reclaim the 
memory by destroying objects which object is cannot be 
referenced anymore. 

Deleting Dynamically created objects from the memory.

Finalize method used to achieve garbage collection.

By using Runtime.gc() or System.gc() the object will be 
garbage collected.
 
Is This Answer Correct ?    0 Yes 0 No
Sivadasan
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Catch(Exception e){ } in that what is Exception and purpose of that in that place exactly?  3
What is a method ?  4
what is use of business objects? Tech-Mahindra3
10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to compile? a)Direction d = NORTH; b)Nav.Direction d = NORTH; c)Direction d = Direction.NORTH; d)Nav.Direction d = Nav.Direction.NORTH;  1
If you are reviewing the code of your team members, what points will you look at, assuming the performance of the application is not so great KPIT2
What is thin driver and thick driver. why it is called so? Logisoft1
Define interface?  2
How to deprecate a method? Show it with proper example. Plz give the answer of this.Thanx in advance. mail me: tanzeem.akhtar@gmail.com  1
Can we override static methods? Bally-Technologies15
if arraylist size is increased from initial size what is the size of arraylist...suppose initial is 100 , if i add 101 element what is the size...  6
What is a compilation unit?  2
what is polymorphism? Zensar5
What is the difference between DataInputStream and BufferedReader  1
how can i connect to database in a applet ?  1
What are different type of access modifiers?  3
why we import both packages java.awt.*; and java.awt.event.*; as java.awt.*; can import all classes na. then what is the need of importing java.awt.event.*; ?  2
How multi processing is achieved in JAVA? BMC4
What happens if an exception is not caught?  4
is there any function in java to make the text to blink?  5
java can provide security ,how can provide? IBM3
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com