Fundamentals16 / 25
Up next

Module import declaration

// Java 25 (JEP 511): import every package exported by java.base
import module java.base;

void main() {
    // List, Map, HashMap, stream all come from the one module import
    List<Integer> xs = List.of(1, 2, 3);
    Map<String, Integer> counts = new HashMap<>();
    counts.put("size", xs.size());
    IO.println(counts);
}
What you're solving

Java 25: import a whole module at once