String is immutable means that : Say s = "hello" would point to certain location , say location 1234h in memory.Now if we modify s = "world" , then s will point to a new location in memory, i.e 2314h(say).Thats the reason String is considered to be immutable, one cannot change contents in same meory location.Acc to this question, String s1 is just appended with s.So it doesnt necessarily show that s1 is mutated
Category:Java Interview Questions
No comments:
Post a Comment