if i enter 5 lines of input by pressing enter, it writes only the 1st line to the file. why is that?
import java.io.*;
class Editor {
public static void main(
String[] args) throws IOException{
BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));
FileWriter fw = new FileWriter("Test.txt");
PrintWriter pw = new PrintWriter(fw, false);
String s = "p";
while(true){
try{
s = bin.readLine();
System.out.println(s);
pw.println(s);
if (s.equals(new String("done"))) {
System.out.println(s);
break;
}
}
catch(IOException e) {
System.out.println("Error " + e);
}
pw.close();
}
}
}