java.time.YearMonth.format() 方法示例 java.time.YearMonth.equals() 方法示例 java.time.YearMonth.from() 方法示例 java.time.YearMonth.format() 方法示例 package com.codingdict; import java.time.YearMonth; import java.time.format.DateTimeFormatter; public class YearMonthDemo { public static void main(String[] args) { YearMonth date = YearMonth.of(2017,12); System.out.println(date); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/yy"); System.out.println(formatter.format(date)); } } java.time.YearMonth.equals() 方法示例 java.time.YearMonth.from() 方法示例