public void updateTxt(ArrayList<MusicalInstrument> arr) throws FileNotFoundException { // instrumentData[0], instrumentData[1], stockQty, soldQty, pPrice, sPrice, numRented FileOutputStream fileOut = new FileOutputStream(TXTFILE); PrintStream out = new PrintStream(fileOut); for (MusicalInstrument m : arr) out.print( "\n" + m.getDescription() + "|" + m.getStockCode() + "|" + m.getQuantityInStock() + "|" + m.getQuantitySold() + "|" + m.getPurchasePrice() + "|" + m.getSellingPrice() + "|" + m.getNumberRented()); out.flush(); out.close(); }