IO class for console I/O
The new IO class provides simple, concise methods for console input and output.
import java.util.Scanner;
Scanner sc = new Scanner(System.in);
System.out.print("Name: ");
String name = sc.nextLine();
System.out.println("Hello, " + name);
sc.close();
String name = IO.readln("Name: ");
IO.println("Hello, " + name);
Dramatically simpler
Two methods replace seven lines of Scanner setup, prompting, reading, and cleanup.
No resource leaks
No Scanner to close — IO methods handle resource management internally.
Beginner-friendly
New developers can do console I/O without learning Scanner, System.out, or import statements.
Preview in JDK 25 as part of implicitly declared classes (JEP 495)
Java 25 introduces the IO class (java.io.IO) as part of the implicitly declared classes feature. It provides static methods like println(), print(), readln(), and read() that replace the verbose combination of System.out and Scanner. IO.readln(prompt) handles both prompting and reading in a single call. The class is automatically available in compact source files and can be used in traditional classes via import.