The multipliedBy() method of ChronoPeriod interface in Java is used to return a new instance of ChronoPeriod after multiplying ‘X’ (a scalar quantity) each element of the period YEAR, MONTH, DAY from a given period. This function operate only on all three YEAR, MONTHS, DAYS.
public ChronoPeriod multipliedBy(int toMultiply)
Parameters: This method accepts a single parameter toMultiply which is the scalar number to be multiplied to the period.
Return Value: This method returns a new instance of ChronoPeriod after multiplying each element of the period with the given toMultiply input.
Exceptions: It throws an ArithmeticException.This exception is caught if numeric overflow occurs.
Below is the implementation of the above method:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.