Simply said, String itself is a ‘reference obj’ not a ‘data obj’
String s1 = "Mississippi";String s2 = s1;s1 = s1.replace('i', '!');System.out.println(s1); // Prints "M!ss!ss!pp!"System.out.println(s2); // Prints "Mississippi"