Language Średniozaawansowany

Import all exported packages of a module with a single declaration.

✕ Java 8
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
✓ Java 25+
import module java.base;

// All of java.util, java.io, java.nio
// etc. available in one line
Widzisz problem z tym kodem? Daj nam znać.
🧹

One line

Replace a wall of imports with a single module import.

📦

Module-aware

Leverages the module system to import coherent sets of packages.

🚀

Quick starts

Perfect for scripts and prototypes where import lists are tedious.

Stare podejście
Many Imports
Nowoczesne podejście
import module
Od JDK
25
Poziom trudności
Średniozaawansowany
Module import declarations
Dostępne

Finalized in JDK 25 LTS (JEP 511, Sept 2025).

Module import declarations let you import everything a module exports with one line. This is especially useful for java.base which covers collections, I/O, streams, and more.

Udostępnij 𝕏 🦋 in