I/O Beginner

The new IO class provides simple, concise methods for console input and output.

I/O
✕ Java 8
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();
✓ Java 25+
String name = IO.readln("Name: ");
IO.println("Hello, " + name);
See a problem with this code? Let us know.

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.

Old Approach
System.out / Scanner
Modern Approach
IO class
Since JDK
25
Difficulty
Beginner
IO class for console I/O
Available

Finalized in JDK 25 alongside compact source files (JEP 512)

Java 25 introduces the IO class (java.lang.IO) alongside the compact source files 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 through java.lang in both compact source files and traditional classes.