MonthDay withMonth(int month) example
Description
MonthDay withMonth(int month)
returns
a copy of this MonthDay with the month-of-year altered.
Syntax
withMonth
has the following syntax.
public MonthDay withMonth(int month)
Example
The following example shows how to use withMonth
.
import java.time.MonthDay;
/*from ww w .j a va2 s . c o m*/
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.