If you initialize a String, and use it, once you are done with it for the duration of the class (say, if you were using it as a query string), will it improve performance and free up server memory if you then set it equals to null?
Thanks!
Java
Last Comment
Webstorm
8/22/2022 - Mon
Webstorm
Hi gdlp2004,
yes, the string will be garbage collector, but you don't knwo when
> but finalize() is only invoked when the object is garbage collected
> or when you explicitly call it, so it the same as directly setting the variable to null
Yap, correct I suggested that for formalization on suggesting garbage collection for all objects =)
yes, the string will be garbage collector, but you don't knwo when