Using the cs220utils Package

Java allows classes to be grouped into packages; for example, the package java.util contains general java utilities such as the Scanner and Random classes, and the package java.awt contains graphics/windowing classes. We often import these packages when we want to use one or more of their classes; if we didn't, we would have to prefix the class name with the package name every time we used it (e.g., java.util.Scanner scan = new java.util.Scanner(System.in)).

Pre-existing Java packages start with "java.", but users can also create their own packages. For example, I have created a package called cs220utils where I can put classes for you to use. This keeps everyone from having to copy the classes I provide, which would be a nuisance and a waste of space, and would pave the way for having numerous slightly different versions of common utilities -- usually not a good idea. Instead I'll put these utilities in a single package, you'll tell the Java system where to look for it, and then import it as needed. To access these classes you need to do the following: