The isZero() method of Duration Class in java.time package is used to check if this duration is of 0 length ot not. It returns a boolean value depicting the same.
public boolean isZero()
Parameters: This method do not accepts any parameter.
Return Value: This method returns a boolean value. If the length is of 0 length, then it returns true. Else it returns false.
Below examples illustrate the Duration.isZero() method:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.