I/O Początkujący

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

✕ 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);
Widzisz problem z tym kodem? Daj nam znać.

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.

Stare podejście
System.out / Scanner
Nowoczesne podejście
IO class
Od JDK
25
Poziom trudności
Początkujący
IO class for console I/O
Preview

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.

Udostępnij 𝕏 🦋 in