What is the life-cycle of an object?
Answer Posted / 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 View All Answers
Should you use singleton pattern?
What is the difference between preemptive scheduling and time slicing in java programming?
What do you mean by default constructor in java?
What is a percentage sign called?
What is natural ordering in java?
Implement a stack with push (), pop() and min() in O(1) time.
What is java argument list?
What is string and example?
What is blank final variable?
What is the major drawback of internal iteration over external iteration?
Which is easier .net or java?
What is passed by reference and pass by value ?
What is jvm? Why is java called the platform independent programming language?
What is the use of isempty in java?
How to reverse a string in java?