As a java beginner I wanted to ask about if I should set an object reference to null, or call the finalize method in a large project?
For example,
while( obj... some code here){
//code stuff
}
obj = null; // or obj.finalize();
Since im done with the obj
and there are no more references to it what should i do with it? set it to null or call finalize();?
I read the java doc but this paragraph The finalize method is never invoked more than once by a Java virtual machine for any given object.
confused me. Does that mean that even if i use it, it won't do anything at all unless GC decides to do so? Then, will my decision to set the obj
to null help any?
This all assuming its a large project and the scope has yet to end in order for GC to deallocate it itself. Thanks.