import java.util.Scanner;
import java.io.*;
public class TextWriter{
public static void main(String[] args){
Scanner stdIn = new Scanner(System.in);
String[] churchill =
{"Before Alamein we never had a victory.",
"After Alamein we never had a defeat."};
PrintWriter fileOut;
try{
System.out.print("Enter filename: ");
fileOut = new PrintWriter(stdIn.nextLine());
for(String line : churchill){
fileOut.println(line);
}
fileOut.close();
}
catch(FileNotFoundException e){
System.out.println(e.getMessage());
}
}//end of main
}//end of TextWriter class
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment