The only why for a string literal to be GCed would be if all classes referencing it were unloaded. And even then the particular garbage collector would have to be designed to delete interned strings, with not all are.
For a class to be unloaded it must be loaded with a user class loader and that loader and all objects and classes referencing the class must be freed/unloaded. This never happens by accident and is hard enough to get to happen on purpose.
(The above code attempts to do this, but, as I said, it's hard to do on purpose, so I can't say if it works or not.)
(And, as alluded to elsewhere, the ability to GC classes has been turned on and off several times in the history of the language and is very likely a startup option on some current JVMs.)