June 2018
Beginner
722 pages
18h 47m
English
Importing allows us to specify a fully qualified class or interface name only once at the beginning of the .java file, before the class or interface declaration. The format of an import statement is as follows:
import <package>.<class or interface name>;
For example, look at the following:
import com.packt.javapath.ch04demo.MyApplication;
From now on, this class can be referred to in the code by its name, MyApplication, only. It is also possible to import all the classes or interfaces of a package using the wildcard character (*):
import com.packt.javapath.ch04demo.*;
Notice that the preceding import statement imports classes and interfaces of the subpackages of the com.packt.javapath.ch04demo package. If needed, each subpackage ...
Read now
Unlock full access