We keep running this error. The goal is to read the data from the array into an output file. Thanks for the help!
public static void save(Salesperson[] array)
{
PrintStream outfile = null;
try
{
outfile = new PrintStream(new FileOutputStream("data.txt"));
}
catch(FileNotFoundException e)
{
JOptionPane.showMessageDialog(null,"The file could not be created.");
}
System.setOut(new PrintStream(new FileOutputStream("output.txt")));
for(int k = 0; k < array.length; k++)
{
System.out.println(array[k]);
}
outfile.close();
System.out.println("Saved.");
}