提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
找出两次约会之间的年份和日期
import java.time.LocalDate; import java.time.Month; import java.time.temporal.ChronoUnit; /*来 自 时代Java - N o w J a v a . c o m*/ public class Main { public static void main(String[] args) { LocalDate anniversary = LocalDate.of(2000, Month.NOVEMBER, 11); LocalDate today = LocalDate.now(); long yearsBetween = ChronoUnit.YEARS.between(anniversary, today); System.out.println("Years between dates: " + yearsBetween); long daysBetween =