/** Simple Program to write a text file
*/

import java.io.*;

public class WriteTextCodePage{
	public static void main(String[] args){
		try {
			FileOutputStream outFile = new FileOutputStream(args[0]);
			OutputStreamWriter outStream = new OutputStreamWriter(outFile,"UTF-8");
			PrintWriter out = new PrintWriter(outFile);
			
			// Also could be written as follows on one line
			// Printwriter out = new PrintWriter(new OutputStreamWrite(outFile));
		
			// Write text to file
			out.println("This is line 1");
			out.println("This is line 2");
			out.print("This is line3 part 1, ");
			out.println("this is line 3 part 2");
			out.close();
		} catch (IOException e){
			e.printStackTrace();
		}
	}
}