The java.lang.IO class lets us do simple input and output when running a program from the terminal.
When it comes to simple output, then Instead of using the System.out.println well-known code snippet, we can do the following:
IO.println("Hello, World!");
When it comes to getting some input from the user, then instead of setting up a Scanner, BufferedReader, or a Console, we can simply do the following:
var name = IO.readln();
The IO Class
The java.lang.IO final class contains the definition of static utility methods, both for input and for output operations through System.in and System.out.
package com.lifemichael.samples;
import java.lang.IO;
public class IODemo {
static void main() {
String name = IO.readln("Your name: ");
IO.println("Hello " + name);
}
}
Compact Source Files
The java.lang.IO class is especially useful when using compact source files. The following code sample shows that.
void main() {
var name = IO.readln("Enter your name: ");
IO.println("Hello, " + name + "!");
}
Using compact source files together with the instance main() method, we can easily develop simple utility programs.







