suppose we have written a programme and we have created an object.now after that we written another programme then will it the memory occupied by the object of previous programme cleared.
garbage collection
Collapse
X
-
Tags: None
-
i dont know which memory is allocated during the creation of object.actually i am not getting the meaning of garbage collection properly.Comment
-
Memory is allocated for an object with the new operator. And now question is, how this memory is deallocated? Unlike C\C++ where memory is deallocated using the delete operator. java handles memory deallocation by an automatic called, Garbage Collection.
when no reference to an object exists , then that object is considered to be no longer required, and hence becomes a suitable candidate for garbage collection.
Garbage collection is an automatic process executed by the JVM which deallocates the memory occupied by the objects that are no longer referenced by any variable.Comment
Comment