CS202 Java-177
Libraries
lTo use a library we must import it:
•import java.util.*;
•This brings in the entire utility library
•And, it manages the namespace since it only brings in those classes that are requested
lWhen we have multiple source files, each file should have a public class that is the same name as the file (including capitalization but excluding the file extension)
lMultiple files can create a “package”
lIf you place
•package list_library;
•As the first non-commented line in your file – you are saying that this compilation unit is part of a larger library that you are building
•SO, there need not be a public class in each file since we are part of a larger unit.
•And, then such packages can be imported!
•If there are collisions in the libraries and packages that you import, then Java will require you to explicitly specify the “classpath” from which the class exists