Let me try.....

jabber (jabber)
The answer is "I am not sure". After line "a=null", "Hello" is an abandoned, or orphan object. After the whole method is finished, all the Strings introduced in the method will be abandoned.

The fact that some objects are abandoned (no longer referenced) does not mean they will be garbage collected immediately. They may be claimed at once if your JVM lacks memory. They may float in JVM's memory until you shut down your JVM (done by System.exit(0) or by return in main() method), provided you machine has a big memory.

Hope this helps.
2001-6-8 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: question about java garbage collector

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论