13. String x = new String("xyz"); //one "xyz" is created in string pool, new String("xyz") will create another string
14. y = "abc"; //one "abc" is created in string pool
15. x = x + y; //one "xyzabc" is created
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by Barry Gaunt:
Better, different question, different topic.
I would also count that five are "created":
But I doubt that both are string object...
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by Barry Gaunt:
... because ...
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.