package J20250715.testString; /** * @author WanJl * @version 1.0 * @title TestString * @description * replace(char oldChar, char newChar) 将字符串中所有的oldChar都换成newChar * @create 2025/7/15 */ public class TestString { public static void main(String[] args) { String s="hello world"; String s1 = s.replace('l', 'z'); System.out.println(s1); } }