A package in java is collection of related classes and interfaces that contain usable method/functions and fields/properties. As per modern specifications there are hundreds on packages with thousands of classes and other types of functional codes.
Some important first level packages are –
java.lang (primary classes)
java.util (scanner, stack, linked list etc.)
java.io (io streamreader/writer and others)
java.awt (abstract windows tooldkit for gui)
java.swing (extension of awt)
java.net (for client server programming)
java.applet (for applet programming)
java.sql (for database interface)
Out of these most java development environments automatically imports the java.lang package while others are required to be imported when any class,interface,method,field etc of the given package are to be used. For example to use the Scanner class features we will write as follows in the beginning of the program –
The * after java.util. means that all the classes and their methods and fields in the util package are usable. one can also import only java.util.Scanner if desired.