// String.replace produces a new String. It does not modify the original. // Since String is immutable, no method can modify the original. String aa = "peal"; String bb = aa.replace( 'a', 'e' ); out.println ( aa + " " + bb ); // Prints "peal peel" not "peel peel" // Newbies often expect String aa to be changed too.