Java tutorial
import java.io.*; public class Main { public static void main(String[] args) { String s = "tutorial from java2s.com"; try { // create a new stream at specified file PrintWriter pw = new PrintWriter(System.out); // write the string in the file pw.write(s); // flush the writer pw.flush(); } catch (Exception ex) { ex.printStackTrace(); } } }