Period isNegative()
checks if any of the three units of this period are negative.
isNegative
has the following syntax.
public boolean isNegative()
The following example shows how to use isNegative
.
import java.time.Period; //from w w w . j a va2 s. com public class Main { public static void main(String[] args) { Period p = Period.ofMonths(1); System.out.println(p.isNegative()); } }
The code above generates the following result.