Java.io.StringWriter.write string len() 方法 Java.io.StringWriter.write String() 方法 Java.io.Writer.append() 方法 Java.io.StringWriter.write string len() 方法 package com.codingdict; import java.io.*; public class StringWriterDemo { public static void main(String[] args) { String s = "Hello World"; // create a new writer StringWriter sw = new StringWriter(); // write strings sw.write(s, 0, 4); sw.write(s, 5, 6); // print result by converting to string System.out.println("" + sw.toString()); } } Java.io.StringWriter.write String() 方法 Java.io.Writer.append() 方法