Java Period additions, subtractions, multiplications, and negation

Description

Java Period additions, subtractions, multiplications, and negation

import java.time.Period;

public class Main {
  public static void main(String[] args) {
    Period p1 = Period.ofDays(5);  
    Period p2 = p1.plusDays(12);   
    Period p3 = p1.minusDays(2);   
    Period p4 = p1.negated();      
    Period p5 = p1.multipliedBy(3); 
    System.out.println(p1);//from www  . j av a2 s . c o  m
    System.out.println(p2);
    System.out.println(p3);
    System.out.println(p4);
    System.out.println(p5);
  }
}



PreviousNext

Related