MonthDay parse(CharSequence text) example
Description
MonthDay parse(CharSequence text)
creates an
instance of MonthDay from a text string such as --12-03.
The string must represent a valid month-day. The format is --MM-dd.
Syntax
parse
has the following syntax.
public static MonthDay parse(CharSequence text)
Example
The following example shows how to use parse
.
import java.time.MonthDay;
// w ww. j a v a 2 s. c om
public class Main {
public static void main(String[] args) {
MonthDay m = MonthDay.parse("--12-03");
System.out.println(m);
}
}
The code above generates the following result.