In chapter 9 of the book, I found these two questions the answers to which, I think are not right. Could someone please clarify.
5. Which of the following methods cause the string object referenced by s to be changed:
Answer: A & B
But aren't string objects immutable? I think none of them is correct.
6. What is the output of the following program?
public class Question
public static void main(String args)
String s1 = "abc";
String s2 = "def";
String s3 = s1.concat(s2.toUpperCase());
D.None of the above
Answer : D
But i think C is correct.
One more question.....are string literals eg: s = "One" garbage collected? If so, when?