java.time.Duration.minusNanos() 方法示例


java.time.Duration.minusNanos() 方法示例

package com.codingdict;

import java.time.Duration;

public class DurationDemo {
   public static void main(String[] args) {

      Duration duration = Duration.ofSeconds(5);
      Duration duration1 = duration.minusNanos(3000);
      Duration duration2 = duration.minusNanos(4000);
      System.out.println(duration1.getNano());
      System.out.println(duration2.getNano());
   }
}