Java.io.StringWriter.write String() 方法


Java.io.StringWriter.write String() 方法

package com.codingdict;



import java.io.*;



public class StringWriterDemo {



   public static void main(String[] args) {

      String s = "Hello";



      // create a new writer

      StringWriter sw = new StringWriter();



      // write strings

      sw.write(s);

      sw.write(" World");



      // print result by converting to string

      System.out.println("" + sw.toString());



   }

}