How do I read input line by line in Java? I searched and so far I have this:
import java.util.Scanner;
public class MatrixReader {
public static void main(S
Ideally you should add a final println() because by default System.out uses a PrintStream that only flushes when a newline is sent. See When/why to call System.out.flush() in Java
while (input.hasNext()) {
System.out.print(input.nextLine());
}
System.out.println();
Although there are possible other reasons for your issue.