1 public class WriteData { 2 public static void main(String[] args) throws java.io.IOException { 3 java.io.File file = new java.io.File("scores.txt"); 4 if (file.exists()) { 5 System.out.println("File already exists"); 6 System.exit(1); 7 } 8 9 // Create a file 10 java.io.PrintWriter output = new java.io.PrintWriter(file); 11 12 // Write formatted output to the file 13 output.print("John T. Perez "); 14 output.println(90); 15 output.print("Jamal K. Johnson "); 16 output.println(85); 17 18 // Close the file 19 output.close(); 20 } 21 }