Java.io.StringWriter.append sequence() 方法


Java.io.StringWriter.append sequence() 方法

package com.codingdict;



import java.io.*;



public class StringWriterDemo {



   public static void main(String[] args) {



      // create a new writer

      StringWriter sw = new StringWriter();



      // create two new sequences

      CharSequence sq1 = "Hello";

      CharSequence sq2 = " World";



      // append sequence

      sw.append(sq1);



      // print result     

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



      // append second sequence

      sw.append(sq2);



      // print result again

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



   }

}