java jar包示例
包類的getSpecificationVendor()方法 (Package Class getSpecificationVendor() method)
getSpecificationVendor() method is available in java.lang package.
getSpecificationVendor()方法在java.lang包中可用。
getSpecificationVendor() method is used to retrieve the name of the vendor that manages the specification of the classes or interface that is implemented by this package.
getSpecificationVendor()方法用于檢索管理由此程序包實現的類或接口的規范的供應商的名稱。
getSpecificationVendor() 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.
getSpecificationVendor()方法是一個非靜態方法,只能通過類對象訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。
getSpecificationVendor() method does not throw an exception at the time of returning specification vendor of the package.
返回包的規范供應商時, getSpecificationVendor()方法不會引發異常。
Syntax:
句法:
public String getSpecificationVendor();
Parameter(s):
參數:
It does not accept any parameter.
它不接受任何參數。
Return value:
返回值:
The return type of this method is String, it returns the name of the company who specializes in this package otherwise it returns null when specification vendor of the package is not known.
此方法的返回類型為String ,它返回專門從事此程序包的公司的名稱,否則,當未知程序包的供應商時返回null。
Example:
例:
// Java program to demonstrate the example
// of String getSpecificationVendor() of Package method
public class GetSpecificationVendor {
public static void main(String[] args) {
// Get Package by using getPackage() method
Package pkg = Package.getPackage("java.util");
// Get specification vendor of the package by using
// getSpecificationVendor() and stored in a variable
// called svendor
String svendor = pkg.getSpecificationVendor();
// Display vendor of the package
System.out.print("Package Vendor: ");
System.out.print(svendor);
}
}
Output
輸出量
Package Vendor: Sun Microsystems, Inc.
翻譯自: https://www.includehelp.com/java/package-getspecificationvendor-method-with-example.aspx
java jar包示例