Java Package class

Package class provides information about a package like a package name, implementation title, etc.

Java Package class Example

package com.w3schools;

public class PackageClassTest {
    public static void main(String args[]) {
        Package package1 = Package.getPackage("java.lang");
        System.out.println("package name: " + package1.getName());
        System.out.println("Specification Title: " 
                              + package1.getSpecificationTitle());
        System.out.println("Specification Vendor: " 
                              + package1.getSpecificationVendor());
        System.out.println("Specification Version: " 
                              + package1.getSpecificationVersion());
        System.out.println("Implementaion Title: " 
                              + package1.getImplementationTitle());
    }
}

Output

package name: java.lang
Specification Title: Java Platform API Specification
Specification Vendor: Oracle Corporation
Specification Version: 1.8
Implementaion Title: Java Runtime Environment