Java tutorial
import java.io.*; public class Main { public static void main(String[] args) { StringWriter sw = new StringWriter(); // create a new sequence String s = "from java2s.com"; // write a string sw.write(s); // flush the writer sw.flush(); System.out.println(sw.toString()); } }