Duration isZero()
checks if this duration is zero length.
A Duration can be positive, zero or negative.
isZero
has the following syntax.
public boolean isZero()
The following example shows how to use isZero
.
import java.time.Duration; import java.time.LocalTime; public class Main { public static void main(String[] args) { Duration duration = Duration.between(LocalTime.MIDNIGHT,LocalTime.NOON); System.out.println(duration.isZero()); } }
The code above generates the following result.