java.time.YearMonth.withMonth() 方法示例 java.time.YearMonth.with(TemporalField field, long newValue) java.time.YearMonth.withYear() 方法示例 java.time.YearMonth.withMonth() 方法示例 package com.codingdict; import java.time.YearMonth; public class YearMonthDemo { public static void main(String[] args) { YearMonth date = YearMonth.parse("2017-12"); YearMonth result = date.withMonth(8); System.out.println(result); } } java.time.YearMonth.with(TemporalField field, long newValue) java.time.YearMonth.withYear() 方法示例