Created
July 31, 2015 03:51
-
-
Save arttuladhar/228f3911b39b0cf20166 to your computer and use it in GitHub Desktop.
PrintWriter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment