The best method to get number of instances created of a specific class is - , make a static 'count' varible and increment it in constructor call, so that you can access that count method through a static method like "static int getCount()" to return the no of objects created ..
Now as per Java api , there is no such method in String class, and String class is "final" , you cant create your own .
And other way to do this , might go from complier and memory management programming or ask sun .
The only definitive solution would be to run the code through a profiler.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus