CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS J2EE JAVA DETAILS
Question :
Does Java have destructors?
Category Java Interview Questions
Rating (2.9) By 12 users
Added on 10/13/2004
Views 1608
Rate it!
Answers:

No garbage collector does the job working in the background.



Hi...
There is no concept of "destructors" in java.Java supports this specility by introducing the "GarbageCollector".The Garbagecollector is under the control of the JVM.JVM runs the Garbagecollector periodically basing on "mark and sweep" algorithms.U can force the garbagecollector by using the System.gc() and Runtime.gc()methods.The purpose of garbage collector to reclaims the memory of objects those are no longer used in the programming segment.



Posted by: DEVARATHNAM C,KOTAGUDIBANDA(PO),KALAKADA(MD),CHITT    

Contact DEVARATHNAM C,KOTAGUDIBANDA(PO),KALAKADA(MD),CHITT Contact DEVARATHNAM C,KOTAGUDIBANDA(PO),KALAKADA(MD),CHITT

No, java does not support destructors. All freeing the memory task is done by GARBAGE COLLECTOR.
But you can do such freeing memory by assigning NULL to it,
ob=NULL;
And then the Garbage Collector frees it because that object have no references to it.



Posted by: Sonika    

Contact Sonika Contact Sonika

If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    What does the "abstract" keyword mean in front of a method? A class?
    View Answer
    Name four methods every Java class will have.
    View Answer
    Given a text file, input.txt, provide the statement required
    View Answer
    Discuss the differences between creating a new class, extending a class and implementing an interface; and when each would be appropriate.
    View Answer
    What's the difference between the == operator and the equals() method? What test does Object.equals() use, and why?
    View Answer
    Why do you create interfaces, and when MUST you use one?
    View Answer
    What is the difference between instanceof and isInstance?
    View Answer
    Are there any other 'marker' interfaces?
    View Answer
    How many methods do u implement if implement the Serializable Interface?
    View Answer
    What are the advantages of OOPL?
    View Answer

    Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

    Notify me when better answer is posted!
    Email:

    View ALL Java Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions
    Page URL: http://www.coolinterview.com/interview/384/default.asp?cachecommand=bypass


    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

    0.88
    Cache = 0.03125 Seconds