summaryrefslogtreecommitdiff
path: root/src/Q6/WeekDay.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Q6/WeekDay.java')
-rw-r--r--src/Q6/WeekDay.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Q6/WeekDay.java b/src/Q6/WeekDay.java
index e7ccc11..c1fb573 100644
--- a/src/Q6/WeekDay.java
+++ b/src/Q6/WeekDay.java
@@ -34,7 +34,8 @@ public class WeekDay {
}
private void ensureValidDate(int year, int month, int day) {
- if (day < 1 || day > MONTHS[month - 1]) throw new IllegalArgumentException();
+ if (month < 1 || month > 12 || day < 1 || day > MONTHS[month - 1])
+ throw new IllegalArgumentException();
}
public static void main(String[] args) {