Results 1 to 2 of 2
- 09-30-2009, 10:26 AM #1Member
- Join Date
- Sep 2009
- Rep Power
Java Garbage Collection and destructors
I am asked several times there two questions in interviews and I need a good answer to give for it if I am asked it in my next interview.
1. What is Garbage Collection in java? how it works in java?
2. Why there is no concept of destructors (like in c++) in java?
Please suggest some good answer to give for these questions at the time of interviews.
Thanks in advance.
- 09-30-2009, 10:48 AM #2
1.Garbage Collection helps programmers from freeing up of allocated memory.It is also very difficult when to free alloted memory.This task has been delicated to JVM by java to make the things more productive.It helps to some extent to avoid memory leaks.
2.Java is a garbage collected language and it is taken care by itself.So,we can't say when the object will be destroyed.Hence ,there is no destructor in java.
Please gothru net also to get more infoRamya:cool:
- By makpandian in forum New To JavaReplies: 3Last Post: 01-23-2009, 09:53 AM
- By piyu.sha in forum Advanced JavaReplies: 3Last Post: 10-06-2008, 08:35 AM
- By Java Tip in forum Java TipReplies: 0Last Post: 03-28-2008, 09:04 PM