Basic HTML version of Foils prepared 19 July 97

Foil 46 Using Java packages

From Java Tutorial - Summer 1997 Part II: Java Language and Object-Oriented Concepts CEWES Tutorial -- July 22-25 1997. by Nancy J. McCracken,Geoffrey C. Fox


One conveniently uses files in a package by inserting
  • import mill.*
at the beginning of a file that needs classes from the mill package
  • Then classes in the mill package can be refered to by just using their Classname
  • Without the import command, one must explicitly say mill.Classname
Packages can be grouped hierarchically, with the corresponding directory tree. For example, the mill package could be a subpackage of agriculture. Then a class is referred to as agriculture.mill.Classname.
Except for classes provided with the Java language, all of which have the form java.X, a class that is imported or used must either be in the current directory or be accessible to the compiler through the CLASSPATH environment variable.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998