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
When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?
What 5 doubled?
What is set in java?
How many threads does a core java have?
What is the structure of java?
List down the methods and interfaces of collection class in java.
What is size of int in java?
What is method overloading with type promotion?
How to change the priority of thread or how to set priority of thread?
What are the differences between checked exception and unchecked exception?
Who found java?
Why does java have different data types for integers and floating-point values?
What is palindrome in java?
What is the length of a string?
What is the return type of the main method?