package chapter5;

public class Example04 {
    public static void main(String[] args) {
        String name = "王小明";
        String newName = name.replace("王", "卢");
        System.out.println("旧名字：" + name + "\n新名字：" + newName);

        System.out.println();

        String name2 = "   王    小明   ";
        String name3 = name2.trim();
        System.out.println("去除空格前：" + name2 + "\n去除空格后：" + name3 );
        // 思考：如何去掉所有空格？
    }
}
