Home » Java programming language

Java Package getImplementationVendor() method with example

Package Class getImplementationVendor() method: Here, we are going to learn about the getImplementationVendor() method of Package Class with its syntax and example.
Submitted by Preeti Jain, on November 30, 2019

Package Class getImplementationVendor() method

  • getImplementationVendor() method is available in java.lang package.
  • getImplementationVendor() method is used to retrieve the name of the implementation vendor of the package (i.e. It returns the name of the company that implements the package).
  • getImplementationVendor() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
  • getImplementationVendor() method does not throw an exception at the time of returning vendor of the package.

Syntax:

    public String getImplementationVendor();

Parameter(s):

  • It does not accept any parameter.

Return value:

The return type of this method is String, it returns the name of the implementation vendor that this vendor implements this package.

Example:

// Java program to demonstrate the example 
// of String getImplementationVendor()
// of Package method

public class GetImplementationVendor {
    public static void main(String[] args) {
        // Get Package by using getPackage() method
        Package pkg = Package.getPackage("java.util");

        // Get implementation vendor of the package by using 
        // getImplementationVendor() and stored in a variable
        // called ivendor
        String ivendor = pkg.getImplementationVendor();

        // Display vendor of the package
        System.out.print("Package Vendor: ");
        System.out.print(ivendor);
    }
}

Output

Package Vendor: Sun Microsystems, Inc.


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.