YearMonth isSupported(TemporalField field)
checks if the specified field is supported.
isSupported
has the following syntax.
public boolean isSupported(TemporalField field)
The following example shows how to use isSupported
.
import java.time.YearMonth; import java.time.temporal.ChronoField; /*from w ww . j a v a 2s . c o m*/ public class Main { public static void main(String[] args) { YearMonth y = YearMonth.now(); boolean m = y.isSupported(ChronoField.YEAR); System.out.println(m); } }
The code above generates the following result.