java jar包示例_Java包getSpecificationVersion()方法和示例
java jar包示例
包類的getSpecificationVersion()方法 (Package Class getSpecificationVersion() method)
getSpecificationVersion() method is available in java.lang package.
getSpecificationVersion()方法在java.lang包中可用。
getSpecificationVersion() method is used to retrieve the specification version of the package that this package implements and the version is a sequence of no negative decimal integer and is separated by "." and may have leading zeros.
getSpecificationVersion()方法用于檢索此程序包實現的程序包的規范版本,該版本是無負十進制整數的序列,并用“?!狈指?。 并可能有前導零。
getSpecificationVersion() 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.
getSpecificationVersion()方法是一種非靜態方法,只能通過類對象訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。
getSpecificationVersion() method does not throw an exception at the time of returning the specification version of the package.
返回包的規范版本時, getSpecificationVersion()方法不會引發異常。
Syntax:
句法:
public String getSpecificationVersion();Parameter(s):
參數:
It does not accept any parameter.
它不接受任何參數。
Return value:
返回值:
The return type of this method is String, it returns the version of the specification that this package implements otherwise it returns null when specification version of the package is not known.
此方法的返回類型為String ,它返回此程序包實現的規范的版本,否則,當未知程序包的規范版本時,它返回null。
Example:
例:
// Java program to demonstrate the example // of String getSpecificationVersion() // of Package methodpublic class GetSpecificationVersion {public static void main(String[] args) {// Get Package by using getPackage() methodPackage pkg = Package.getPackage("java.util");// Get specification version of the package by using // getSpecificationVersion() and stored in a variable// called sversionString sversion = pkg.getSpecificationVersion();// Display version of the packageSystem.out.print("Package Version: ");System.out.print(sversion);} }Output
輸出量
Package Version: 1.4翻譯自: https://www.includehelp.com/java/package-getspecificationversion-method-with-example.aspx
java jar包示例
總結
以上是生活随笔為你收集整理的java jar包示例_Java包getSpecificationVersion()方法和示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 你没有见过的 7 种 for 循环优化,
- 下一篇: linkedhashset_Java L