|
There is
one exception to the import rule. All classes in the java.lang
package are imported by default. Thus you do not need to import
java.lang.*; to use them without fully qualifed names.
Consider the System.out.println()
method we've been using since the first day of class.
System is really
the java.lang.System class. This class has a public
static field called out which is an instance of the java.io.PrintStream
class. So when you write System.out.println(), you're really
calling the println() method of the out field of
the java.lang.System class.
|