Java Reference
In-Depth Information
16.11. Packages
If you invoke the getPackage method on a Class object, you get a Package
object that describes the package in which the class lives (the Package
class is defined in java.lang ). You can also get a Package object by invok-
ing the static method getPackage with the name of the package, or you
can use the static getPackages method which returns an array of all known
packages in the system. The getName method returns the full name of the
package.
Package objects are used differently than the other reflective typesyou
can't create or manipulate packages at run time. You use Package objects
to obtain information about a package, such as its purpose, who created
it, what version it is, and so on. We defer a discussion on this until we
look at packages in detail in Chapter 18 .
 
Search WWH ::




Custom Search