Java Reference
In-Depth Information
I have created a PackageInfo application that demonstrates most of Table 4-2 ' s
Package methods. Listing 4-3 presents this application's source code.
Listing 4-3. Obtaining information about a package
class PackageInfo
{
public static void main(String[] args)
{
if (args.length == 0)
{
System.err.println("usage: java PackageInfo pack-
ageName [version]");
return;
}
Package pkg = Package.getPackage(args[0]);
if (pkg == null)
{
System.err.println(args[0]+" not found");
return;
}
System.out.println("Name: "+pkg.getName());
System.out.println("Implementation title: "+
pkg.getImplementationTitle());
System.out.println("Implementation vendor: "+
pkg.getImplementationVendor());
System.out.println("Implementation version: "+
pkg.getImplementationVersion());
System.out.println("Specification title: "+
pkg.getSpecificationTitle());
System.out.println("Specification vendor: "+
pkg.getSpecificationVendor());
System.out.println("Specification version: "+
Search WWH ::




Custom Search