I have a list with several objects each containing three strings, how should I format the output (in outfile.format()) to make it look like in the sample output below?
public void save() { try { PrintWriter outfile = new PrintWriter (new BufferedWriter (new FileWriter("reg_out.txt"))); for (int i = 0; i < list.size(); i++) { outfile.format("???", list.get(i).getLastName(), list.get(i).getFirstName(), list.get(i).getNumber()); } outfile.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } Sample output in reg_out.txt:
Allegrettho Albert 0111-27543 Brio Britta 0113-45771 Cresendo Crister 0111-27440