Hi,
Here is a question about
String objects..
The statement ...
String s = "Hello" + "Java";
yields the same value for s as ...
String s = "Hello";
String s2= "Java";
s.concat( s2 );
1.True
2.False
The answer given is False.
I think it should be true. Because although String objects are immutable, the final object pointed to by reference s is the same --> HelloJava.
I tried running this and it says false (s.equals(new s)).
How come? Where am I going wrong?
Regards,
Kapil