Me and my friend was discussing on Strings and we stuck on this:
String str = \"ObjectOne\"+\"ObjectTwo\";
He says total three Object will
String str1 = "ObjectOne"; String str2 = "ObjectTwo"; str1 = str1+str2;
In above case three objects will be created.
But when you define like
String str = "ObjectOne"+"ObjectTwo";
then only one object will be created. Compiler optimizes it.