Period isNegative() method in Java with Examples
The isNegative() method of Period class in Java is used to check whether any of the three YEAR, MONTH, DAYS in period is negative or not.
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. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public boolean isNegative()
Parameters: This method does not accepts any parameter.
Return Value: This method returns True if any of the three valued YEARs, MONTHS, DAYS for the given period is negative, else this will return false.
Below programs illustrate the isNegative() method in Java: