To use a package, specifying the location of a package is a time taking job. Hence, import concept is used. A package is imported for making a class or a package visible to a program.
Syntax 1: Importing an explicit class name
Syntax 2: Importing an entire package
where, package1 is a top package and package 2 is a subordinate package. You can use any hierarchical structure to get the desired package.