But "java.lang.String#concat(String). i.e. A String instance is created and returned, however, the return value is ignored and therefore, is not counted in the total count of String instances."
According to the above quote. the answer will me 6 and 8..
I'm not sure, but i guess that the above statement does not actually refer to the number of Strings created. If "the return vale is ignored and therefore, not counted in the total number os instances", it doesn't mean that the Strings were not created. It just means that they were ignored and lost.
Originally posted by Soumy S:
I thought the answer is 8 and 10.
So do I. I may agree with the above statement and also stick with the opinion that 8 String objects were created prior to the last line and 10 Strings objects were created in total. However, i also agree that the above statement may cause some misunderstanding. [ February 05, 2005: Message edited by: Leandro Melo ]
SCJP 1.4, SCWCD 1.4
Something about .... going for a swim. With this tiny ad ...
Free, earth friendly heat - from the CodeRanch trailboss