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 |
How to declare objects of a class ?
0 Answers Akamai Technologies,
What is the use of isempty in java?
What is a “stateless” protocol ?
I was asked to draw the class diagram for the below scenario which should obey OOPS concept. A Portal is to be developed for a school , which has 3 main divisions viz , Education , Admin & Trust. Each division has 2 sub divisions Kinder Garden & Higer Secondary.
What is the map interface in java programming?
What is the difference between overloading and overriding a function?
13 Answers eG Innovations, Infosys, TCS,
Write POJO class as a key to hashmap???
What is the use of string and stringbuffer?
How to make class immutable
What is the default size of load factor in hashing based collection?
System.out & System.in are final static data member of System class but we can change there reference through setOut() & setIn() method how...
why is multiple inheritance not allowed in java?
7 Answers Elementus Technologies, Huawei, Infosys,