What is the life-cycle of an object?
Answers were Sorted based on User's Feedback
The life cycle of an object starts with instantiation and ends with garbage collection
| Is This Answer Correct ? | 51 Yes | 3 No |
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 |
is there any function in java to make the text to blink?
What does || mean in code?
What is a method in coding?
What happens if constructor is private?
Can we overload the methods by making them static?
Can we have this () and super () together?
How do you use substring in java?
Explain the usage of this with constructors?
Does constructor be static?
What are the two main uses of volatile in Java?
Explain the available thread states in a high-level?
Explain wrapper classes in java?