java.time.Duration.compareTo() 方法示例 java.time.Duration.between() 方法示例 java.time.Duration.dividedBy() 方法示例 java.time.Duration.compareTo() 方法示例 package com.codingdict; import java.time.Duration; import java.time.LocalTime; public class DurationDemo { public static void main(String[] args) { Duration duration = Duration.between(LocalTime.NOON,LocalTime.MAX); Duration duration1 = Duration.between(LocalTime.NOON,LocalTime.MIN); System.out.println(duration.compareTo(duration1)); System.out.println(duration1.compareTo(duration1)); System.out.println(duration1.compareTo(duration)); } } java.time.Duration.between() 方法示例 java.time.Duration.dividedBy() 方法示例