Packages

The main reason for using packages is to guarantee the uniqueness of class names.

 

Static Imports

For example, if you add the directive

import static java.lang.System.*;

 

to the top of your source file, then you can use static methods and fields of the System class without the class name prefix:

out.println("Goodbye, World!"); // i.e., System.out
exit(0); // i.e., System.exit
posted @ 2010-09-13 13:31  露初晞  Views(198)  Comments(0)    收藏  举报