Home Segments Top Top Previous Next

652: Mainline

As you learned in Segment 479, when you use a package name with an asterisk in an import statement, you tell Java you are interested in all the package's public classes, and in the compilation units in which those classes appear, as follows:

                               *-- No compilation unit mentioned; 
                               |   all compilation units available 
                               v 
import onto.java.entertainment.* 

Alternatively, you can specify a specific public class, and the compilation unit in which it appears, in place of the asterisk:

                                 *-- A compilation unit mentioned; 
                                 |   one compilation unit available 
                                 v 
                               ---------- 
import onto.java.entertainment.Attraction