Package getSpecificationVersion() Method

Advertisements


Description

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.

Declaration

Following is the declaration for java.lang.Package.getSpecificationVersion() method

public String getSpecificationVersion()

Parameters

  • NA

Return Value

This method returns the specification version, null is returned if it is not known.

Exception

  • NA

Example

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.6



Advertisements
Advertisements