java clock计时_Java Clock类| systemUTC()方法与示例
java clock計時
Clock Class systemUTC()方法 (Clock Class systemUTC() method)
systemUTC() method is available in java.time package.
systemUTC()方法在java.time包中可用。
systemUTC() method is used to get a Clock that implements the suitable system clock in the UTC zone.
systemUTC()方法用于獲取在UTC區域中實現適當系統時鐘的Clock。
systemUTC() method is a static method, it is accessible with the class name and if we try to access the method with the class object then we will not get an error.
systemUTC()方法是靜態方法,可以使用類名進行訪問,如果嘗試使用類對象訪問該方法,則不會出錯。
systemUTC() method does not throw an exception at the time of representing Clock.
在表示Clock時, systemUTC()方法不會引發異常。
Syntax:
句法:
public static Clock systemUTC();Parameter(s):
參數:
None
沒有
Return value:
返回值:
The return type of this method is Clock, it returns the present instant that use the relevant system clock in the UTC zone.
該方法的返回類型為Clock ,它返回使用UTC區域中相關系統時鐘的當前時刻。
Example:
例:
// Java program to demonstrate the example // of systemUTC() method of Clockimport java.time.*;public class SystemUTCOfClock {public static void main(String args[]) {// Instantiates a ZoneId for Accra ZoneId zone_1 = ZoneId.of("Africa/Accra");// Instantiates a clock for// the given zone_1 Clock cl1 = Clock.system(zone_1);// returns a Clock that returns the current// instant with help of using the system clock // in the UTC time-zoneClock sys_utc_zone = cl1.systemUTC();System.out.println("cl1.systemUTC(): " + sys_utc_zone.toString());sys_utc_zone = Clock.systemUTC();System.out.println("Clock.systemUTC(): " + sys_utc_zone.toString());} }Output
輸出量
cl1.systemUTC(): SystemClock[Z] Clock.systemUTC(): SystemClock[Z]翻譯自: https://www.includehelp.com/java/clock-systemutc-method-with-example.aspx
java clock計時
總結
以上是生活随笔為你收集整理的java clock计时_Java Clock类| systemUTC()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [转载] Python中str跟int的
- 下一篇: kotlin半生对象_Kotlin程序|