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


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

package com.codingdict;

import java.time.Period;

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

      Period period = Period.ofYears(5);
      System.out.println(period.getYears());
      Period period1 = period.minusYears(3);
      System.out.println(period1.getYears());
   }
}