arttuladhar
7/31/2015 - 3:51 AM

PrintWriter

PrintWriter

import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.Writer;

public class PlayingWithStrings {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		PrintWriter syslog = null;
		PrintWriter screen = new PrintWriter(System.out,true);

		try {
			syslog = new PrintWriter("syslog.txt");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			return;
		}

		syslog.println("Starting Program");
		screen.println("Starting the Program");

		syslog.println("Logid");
		screen.println("Processing Logic");

		syslog.println("Closing Log");
		screen.println("Closing Log File");

		syslog.close();

	}

}