I wanted to print the whole string pool which contains literals and String objects added using intern() just before garbage collection.
Is
http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#finalize%28%29 , So the GC calls finalize method before clean-up any of the objects.
So the finalize method in String is also getting called. But sadly String is a final class and you cannot override it. (Why is String class declared final in Java?)
But If you really want to get this thing to be worked, then you need to create your own string object named something else, but inner behaviour will keep all the strings functions.
And for a guaranteed GC try this : http://code.google.com/p/jlibs/wiki/GarbageCollection