I have a file with the following input:
ADD 1 2
SUB 2 1
MUL 2 3
DIV 4 2
QUIT
with this part of the code:
BufferedReader in = null;
String input = "";
in = new BufferedReader(fin);
while ((input = in.readLine()) != null)
{
String line = in.readLine();
System.out.println(line); // for me to see the output
out.println(line); // thats for my server
out.flush(); // for the server
}
but it only shows:
MUL 2 3
DIV 4 2
null
Try this:
You were reading input from file twice, once in the while statement and once after the while statement.