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

How to create a custom exception?

0 Answers  


Where is const variable stored?

0 Answers  


What is the role of the java.rmi.naming class?

0 Answers  


Explain the importance of finally over return statement?

0 Answers  


what are three ways in which a thread can enter the waiting state? Or what are different ways in which a thread can enter the waiting state? : Java thread

0 Answers  






How a string is stored in memory?

0 Answers  


Name the packages in JDK?

2 Answers  


How many types of interfaces are there?

0 Answers  


What is an Applet ?

2 Answers  


How do you compare two strings lexicographically?

0 Answers  


What does yield method of the thread class do?

0 Answers  


When is an object in the mean to garbage collection?

3 Answers  


Categories