How can we know that how many string object resides in string litral pools.
is there any mechanism or java code available that will give me the number of String object that are curruntly in string pool ???
How can we know that how many string object resides in string litral pools.
is there any mechanism or java code available that will give me the number of String object that are curruntly in string pool ???
is there any mechanism or java code available that will give me the number of String object that are curruntly in string pool ???
No, no such mechanism exists in the JDK.
no there is no mechanism exist but if you want to know more about string pool than
No, there is no direct mechanism to access the String pool, since its privately maintained by the String class. But we can check and see if the pool contains a particular String object using:-
StringObject.intern(); //Returns a canonical representation for the string object.
Although There might be a workaround for this, I have never tried or used this approach, You can go ahead and investigate a little bit.
This is related to using VisualVM to see runtime memory values,
http://java.dzone.com/articles/visualvm-see-whats-your-heap
http://netbeans.dzone.com/vvm-displaying-java-memory-pool-stats