Scanner scan = new Scanner(System.in) while(scan.hasNext()) { System.out.println(scan.nextLine()+"\n") }
Scanner scan = new Scanner(System.in) while(scan.hasNext()) { System.out.println(scan.nextLine()+"\n") }
How do you think this code will handle binary data? How do you think it'll handle a simple two line text file?
Yeah, but there are solutions that actually solve the problem.
This solution (and whatever solution you might have in mind) likely both dont solve all sorts of problems. for instance what if there is a power failure and you lose all the output? is it persisting to disk? what if new input methods that arent even thought of it come to exist 5 years from now, is it compatible with that?
You are missing the point. The code doesn't work. I'd love to hear any interpretation of the problem where that code actually is correct.
My hate is on the Java code being posted here. It's horribly bad.