使用java.time.YearMonth类。
/* 来自 n o w j a v a . c o m - 时代Java*/ YearMonth yearMo = YearMonth.now(); System.out.println("Current Year and month:" + yearMo); YearMonth specifiedDate = YearMonth.of(2000, Month.NOVEMBER); System.out.println("Specified Year-Month: " + specifiedDate);