There are many packages to choose from. In the previous example, we used the Scanner
class from the java.util
package. This package also contains date and time facilities, random-number generator and other utility classes.
To import a whole package, end the sentence with an asterisk sign (*
). The following example will import ALL the classes in the java.util
package:
Example
import java.util.*;
Practice Excercise Practice now