Year isSupported(TemporalUnit unit)
checks if the specified unit is supported.
isSupported
has the following syntax.
public boolean isSupported(TemporalUnit unit)
The following example shows how to use isSupported
.
import java.time.Year; import java.time.temporal.ChronoUnit; // w ww .ja v a2s. c o m public class Main { public static void main(String[] args) { Year y = Year.of(2014); System.out.println(y.isSupported(ChronoUnit.YEARS)); } }
The code above generates the following result.