Hi all,this program append records to a file,I like to know if ispossible to include a header something like " welcome to my program " but I need it one time to print on the file not everytime I add a record or when I login to my program,is it possible ?
and what about searching inside the records fields ,does ArrayList is the best solution ? knowing that the toString() methods includes many fiels (name,last name,..etc )here is my code ,thanks everybody for any help....
and what about searching inside the records fields ,does ArrayList is the best solution ? knowing that the toString() methods includes many fiels (name,last name,..etc )here is my code ,thanks everybody for any help....
Code:
public void writeToFile(String filename){ try { String fileName = "myFile.txt"; BufferedWriter out = new BufferedWriter(new FileWriter(fileName, true)); out.write(toString() + "\n"); out.flush(); out.newLine(); out.close(); } catch (Exception e) { System.out.println("IOException:"); e.printStackTrace(); } } }
Comment