EMZETT.
Login

Input and Output (I/O)

In short: Input and output (I/O) describes a program’s data exchange with the outside world: keyboard, console, files, network.

In more detail: Java uses data streams: InputStream/OutputStream for bytes, Reader/Writer for text.

In Depth

try (BufferedReader r = new BufferedReader(new FileReader("data.txt"))) {
    String line;
    while ((line = r.readLine()) != null) System.out.println(line);
}

try-with-resources closes streams automatically. Modern classes: java.nio.file.Files. See System.out, input, output.

See also: System.out, Input (Input Device), Output (Output Device)