package chapter21;

public class WriteData {
    //public static void main(String[] args) throws Exception {
    public static void main(String[] args) throws Exception {
        java.io.File file = new java.io.File("scores5.txt");
        if (file.exists()) {
            System.out.println("File already exists");
            System.exit(0);
        }

        // Create a file
        //java.io.PrintWriter output = new java.io.PrintWriter(file);
        java.io.PrintWriter output = new java.io.PrintWriter("scores4.txt");
        
        // Write formatted output to the file
        output.print("John T Smith ");
        output.println(90);
        output.print("Eric K Jones ");
        output.println(85);

        // Close the file
        output.close();
    }
}
