java.time.Period.negated() 方法示例


java.time.Period.negated() 方法示例

package com.codingdict;

import java.time.Period;

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

      Period period = Period.ofDays(5);
      System.out.println(period.getDays());
      Period period1 = period.negated();
      System.out.println(period1.getDays());
   }
}