String testLine=id+" "+name+" "+NewQuizz;
Scanner ReadScanner3 = new Scanner(new FileInputStream("input.txt"));
FileOutputStream Out=new FileOutputStream("temp.txt");
PrintWriter pwrite=new PrintWriter(Out);
while(ReadScanner3.hasNextLine()) {
line=ReadScanner3.nextLine();
id=Integer.parseInt(line.substring(0, line.indexOf(' '))) ;
pwrite.println(infoAfterModfiy);
}
System.out.print("after grade modifcation:");
String printModfiy=SearchID+"\t\t"+name+"\t\t"+printNewQuizz;
System.out.println(printModfiy);
pwrite.close();
Scanner ReadScanner4 = new Scanner(new FileInputStream("temp.txt"));
FileOutputStream Out2=new FileOutputStream("input.txt");
PrintWriter pwrite2=new PrintWriter(Out,true);
while(ReadScanner4.hasNextLine()) {
String Line=ReadScanner4.nextLine();
pwrite2.println(Line);
}
pwrite2.close();
}
hello hope you all good. I have problem with the overwriting if i changed the quize grade and I display it again it delete everything in input.txt
sample input
91007 Ahmad Said 50.0
91004 Hassan Khan 45.5
91003 Suleiman Wasim 72.6
91002 Majed Sameer 60.0
91006 Muhammad Adel 85.5
91005 Muhsim Zuheir 70.0
91001 Muneeb Abdullatif 30.0