This method checks if the provided TemporalField supported by this instance.
This methods check if the provided TemporalUnit is supported by this instance.
package com.logicbig.example.localtime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
public class IsSupportedExample3 {
public static void main (String... args) {
LocalTime d = LocalTime.now();
boolean b = d.isSupported(ChronoUnit.MONTHS);
System.out.println(b);
LocalTime d2 = d.plus(5, ChronoUnit.MONTHS);
System.out.println(d2);
}
}
Output
Caused by: java.time.temporal.UnsupportedTemporalTypeException: Unsupported unit: Months
at java.time.LocalTime.plus(LocalTime.java:1055)
at com.logicbig.example.localtime.IsSupportedExample3.main(IsSupportedExample3.java:19)
... 6 more