What is the life-cycle of an object?

Answers were Sorted based on User's Feedback



What is the life-cycle of an object?..

Answer / javamasque

The life cycle of an object starts with instantiation and ends with garbage collection

Is This Answer Correct ?    51 Yes 3 No

What is the life-cycle of an object?..

Answer / chantiraji

Object creation
---------------
The operator new allocates storage in the heap and invokes a constructor method for initialization of the object.

Object deletion
---------------
The Java garbage collector runs in parallel (as a thread) with the executing program, so garbage collection is in some sense continuous in Java. A class can have a finalize method that is to be invoked (automatically) before deleting an object. This is useful in case there are any resources, such as an open file, that need to be released by the object before it is removed from the system.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is Overriding and how can it be used?

7 Answers   Consagous, Wipro,


What is clipping?

2 Answers  


What is the difference between the file and randomaccessfile classes?

0 Answers  


Is ResultSet class?

5 Answers   Bally Technologies, TCS,


What is object-oriented programming?

0 Answers  






Difference between interface and abstract class with ex.

4 Answers   Cognizant, Tech Mahindra,


What is a newline character in java?

0 Answers  


Nullpointer exception is a very common exception. Why is it not made as a checked exception?

2 Answers   Ness Technologies,


what is polymorhism what is inheritance? what is Abstract n Interface? what if two interfaces have same method and a concrete class is implementing both the interfaces. Will there be a compilation error? What are mutable and immutable classes? How can u make a class mutable? when will u use dem ...explain with example? what is overriding and overloading? what is garbage collection? what is Thread? how do dey communicate? what are the different ways of implementing ? have u used any messaging technologies? what is synchronization? what are some additions in java 1.5? what are generics? whst is advanced for loop? what is finally block? can u have a try in finally? yes!! can u have a finally in finally? how do you write junits? when is a object eligible for garbage collection?explain? a = null and b has ref to a will b be eligible to be garbage collected? sql questions like diff joins? how do dey work? exception handling? what is marker interface? what is the need??

0 Answers   JPMorgan Chase,


Can we extend singleton class in java?

0 Answers  


What are sets in java?

0 Answers  


What is numeric data type?

0 Answers  


Categories