mustloadtheirassociatedclassfilesviaspecialcodeknownasa classloader (discussed
sociated with the encountered type in a search for that type's classfile.
lowed by the user classpath (in left-to-right order) for the first classfile that contains
matches or the type cannot be found, a “no class definition found” error is reported.
Otherwise, the classfile is loaded into memory.
Note Whetheryouusethe -classpath optionorthe CLASSPATH environment
variable to specify a user classpath, there is a specific format that must be followed.
Under Windows, this format is expressed as path1;path2;... , where path1 ,
format changes to path1:path2:... .
Playing with Packages
Suppose yourapplication needs to log messages to the console, to a file, orto another
ation of this library consists of an interface named Logger , an abstract class named
LoggerFactory , and a pair of package-private classes named Console and File .
Note ThelogginglibrarythatIpresentisanexampleofthe Abstract Factory design
pattern , which is presented on page 87 of Design Patterns: Elements of Reusable
Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John
Vlissides (Addison-Wesley, 1995; ISBN: 0201633612).
Listing 3-17 presents the Logger interface, which describes objects that log mes-
Listing 3-17. Describing objects that log messages via the Logger interface
public interface Logger