Hope It will useful. [ April 07, 2005: Message edited by: Raghu Shree ]
Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
No, in fact they can be garbage collected, but only under specific unusual conditions. Specifically, the class(es) that use a given literal must first be unloaded. (Or at least, eligible for unloading.) Otherwise that class definition will contain reachable references to the pooled string object. The pool itself doesn't prevent GC of the objects in the pool (that is, the objects on the heap which are referenced by the pool) - but the class(es) which use the pooled instances usually have other references which prevent GC.
As usual when string pooling is mentioned, this is far more information than you need to know for the exam. So if this seems too complicated, don't worry - the exam is not going to ask you whether pooled strings can be garbage collected.