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 -05:00

回到话题: question about java garbage collector

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论