The java.lang.Package.getSpecificationVersion() method returns the version number of the specification that this package implements. This version string must be a sequence of positive decimal integers separated by "."'s and may have leading zeros. When version strings are compared the most significant numbers are compared.
Following is the declaration for java.lang.Package.getSpecificationVersion() method
public String getSpecificationVersion()
NA
This method returns the specification version, null is returned if it is not known.
NA
The following example shows the usage of lang.Object.getSpecificationVersion() method.
package com.tutorialspoint; public class PackageDemo { public static void main(String[] args) { // get the java lang package Package pack = Package.getPackage("java.lang"); // print the specification version for this package System.out.println("" + pack.getSpecificationVersion()); } }
Let us compile and run the above program, this will produce the following result −
1.8