Package Imports in JShell of Java 9



In general, 10 packages are imported using the JShell.

The following command shows the packages that were imported by default.

jshell> /import

Output

import java.io.*
import java.math.*
import java.net.*
import java.nio.file*
import java.sql.*
import java.util.*
import java.util.regex*
import java.util.function*
import java.util.prefs*
import java.util.stream.*

Importing a specific package using JShell

jshell> import java.util.*;

Advertisements