[java] How to read input with multiple lines in Java

A lot of student exercises use Scanner because it has a variety of methods to parse numbers. I usually just start with an idiomatic line-oriented filter:

import java.io.*;

public class FilterLine {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(
            new InputStreamReader(System.in));
        String s;

        while ((s = in.readLine()) != null) {
            System.out.println(s);
        }
    }
}