Period negated() example
Description
Period negated()
returns a new instance with each amount in this period negated.
Syntax
negated
has the following syntax.
public Period negated()
Example
The following example shows how to use negated
.
import java.time.Period;
/*from w w w . j av a 2 s .co m*/
public class Main {
public static void main(String[] args) {
Period p = Period.ofMonths(123);
Period l = p.negated();
System.out.println(l);
}
}
The code above generates the following result.