A.10. PackagesThe Java classes are grouped into packages. You can use any of classes in the package java.lang. If you wish to use classes in packages other than java.lang, you can use an import statement. Import statements go before the class declaration in a file. You can import all the classes in a package using: import name.*; or you can import just a named class using: import name.ClassName; To import all classes in the java.awt package use: import java.awt.*; To import just the class java.awt.Color use: import java.awt.Color; If you don't import the package or the class, you can use the full name, which is the package name followed by '.' and then the class name (java.awt.Color). Here is a table of some of the packages in Java and the interfaces and classes we have used from each of these packages. The interfaces are shown in italics.
|