提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
替换StringBuffer中的值
public class Main { public static void main(String[] args) {/* 来自 n o w j a v a . c o m - 时 代 Java*/ StringBuffer sb = new StringBuffer("Hello World"); System.out.println("Original Text : " + sb); sb.replace(0,5,"Hi"); System.out.println("Replaced Text : " + sb); } }