Java tutorial
import java.io.*; public class Main { public static void main(String[] args) { StringWriter sw = new StringWriter(); // write a string sw.write("tutorial from java2s.com"); // print result by getting the buffer System.out.println("" + sw.getBuffer()); } }