You don't need to import java.lang.*

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 qualified 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 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.

Previous | Next | Top | Cafe au Lait

Copyright 1997 Elliotte Rusty Harold
Last Modified July 24, 1997