MonthDay withMonth(int month)
returns
a copy of this MonthDay with the month-of-year altered.
withMonth
has the following syntax.
public MonthDay withMonth(int month)
The following example shows how to use withMonth
.
import java.time.MonthDay; //from w ww. ja v a 2 s. com public class Main { public static void main(String[] args) { MonthDay m = MonthDay.now(); MonthDay n = m.withMonth(1); System.out.println(n); } }
The code above generates the following result.