4 ms·
public static void main(String[]args) throws IOException { Scanner sc = new Scanner(System.in); String line; while((line=sc.readLine())!=null) Sy
by chatman 13y ago
public static void main(String[]args) throws IOException {
Scanner sc = new Scanner(System.in);
String line;
while((line=sc.readLine())!=null)
System.out.println(line);
}
What's so verbose about it?
- jsight 13y agoYou didn't import Scanner, and java.util.Scanner (what I assume you are using) does not have a readLine method. :)
- cbsmith 13y agoSo, that actually is going to have problems with binary data in the file. However, you are correct it doesn't need to be terribly verbose (not as efficient as it could be, but that is easily fixable): https://gist.github.com/cbsmith/9755809 https://gist.github.com/cbsmith/9755809 It's amazing though how often the solutions posted are just wrong.