Period negated()
returns a new instance with each amount in this period negated.
negated
has the following syntax.
public Period negated()
The following example shows how to use negated
.
import java.time.Period; /* ww w .ja v a 2 s . c om*/ 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.