|
INTERVIEW QUESTIONS
J2EE
JAVA
DETAILS
Question: Does Java have destructors?
Answer: No garbage collector does the job working in the background.
|
|
|
Category |
Java Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7900 users |
Added on |
10/13/2009 |
Views |
75158 |
Rate it! |
|
|
Question:
Does Java have destructors?
Answer:
No garbage collector does the job working in the background. Source: CoolInterview.com
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. Source: CoolInterview.com
Answered by: DEVARATHNAM C,KOTAGUDIBANDA(PO),KALAKADA(MD),CHITT | Date:
| 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. Source: CoolInterview.com
Answered by: Sonika | Date: 2/6/2010
| 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.
|
|
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
|
|
What do mean by polymorphism, inheritance, encapsulation?
|
View Answer
|
|
What do you mean by static methods?
|
View Answer
|
|
What do you mean by virtual methods?
|
View Answer
|
|
Given two tables Student(SID, Name, Course) and Level(SID, level) write the SQL statement to get the name and SID of the student who are taking course = 3 and at freshman level.
|
View Answer
|
|
What are the disadvantages of using threads?
|
View Answer
|
|
Write the Java code to declare any constant (say gravitational constant) and to get its value.
|
View Answer
|
|
What do you mean by multiple inheritance in C++ ?
|
View Answer
|
|
Can you write Java code for declaration of multiple inheritance in Java ?
|
View Answer
|
|
What are the Object and Class classes used for?
|
View Answer
|
|
What is Serialization and deserialization?
|
View Answer
|