Strings are immutable. But String s=\"Hello\"; String s1=s+\"World\" returns HelloWorld how ?
String s=\"Hello\"; String s1=s+\"World\"; In the second line above, We are trying to concatenating the \"Hello\" and a new strign object \"World\". Here a new object is created \"HelloWorld\" and returned to the reference s1. Since string objects are immutable, the reference s is still pointing to \"Hello\".