public static void main(String [] args){
String s = \"java\"; //line 1
s.concat(\" SE 6\"); //line 2
s.toLowerCase(); //line 3
System.out.print(s);
3 Java Strings are created.
1. "java" -> Goes into String constants pool // will be added if no already present
2. " SE 6" --> Goes into String constants pool?
3. java SE 6 --> Goes on heap (call to concat)// Note : You are not re-assinging the value returned from concat() So s will still be "java"
** toLowerCase() \\ does nothing in your case since "java" is already present. toLowerCase retruns the same "java" object ( as there is no modification required to turn it into lowercase)