userText will be a string of around 7000 characters in different languages. I was wondering how the strings will be garbage collected after executing this code. For suppose after unescapeHtml4 userText is assigned a new value and the same thing with after replace.
what happens to the previous string of userText. will they be in string pool or will be removed by the garbage collector.
String userText = context.getRequestParameter( "addedText");
if ( someCondition)
{
userText = StringEscapeUtils.unescapeHtml4( userText ) );
}
else
{
userText = userText.replace( charsequence1, charsequence2 );
}
-- some logic using userText ---