Zebra0.com

java ifelseTest if a number is a valid month

Test if a number is a valid month

We want to test if a number is a valid month. In the first example, we test if the month is valid, using && (and). The number is a valid month if it is greater than or equal to 1 AND it is less than of equal to 12.