Hi All,
I had a question from Strings that appeared in SHE mock exam:
Given a string s, constructed by calling s = new String("xyzzy"), which of the calls listed below modify the string represented by s? (Choose all that apply.)
a.) s.append("aaa");
b.) s.trim();
c.) s.replace('z', 'a');
d.) s.concat();
e.) s.substring('3')
-------------------------------------
Correct answer was given as: None
Explanation: Strings are immutable
If the Strings are immutable, why are the methods in the Strings class provided in the first place? Can anyone explain?