Basic HTML version of Foils prepared Sept 6 1998

Foil 41 Using Java packages

From Java Tutorial 98-2: Java Language and Object Oriented Techniques CPS606 Fall Semester 1999 -- Sept 7 1999. by Geoffrey C. Fox, Nancy McCracken


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
  • ithout 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 Mon Sep 6 1999