TIAA interview question

What is string in java and reason for its immutability.

Interview Answer

Anonymous

Feb 18, 2021

String is a final class provided for string operations such as concat, replace, substring, length, etc. The reasons for immutability of the String objects are Security, thread safety(multithread consistency), etc.