When I input "1", it shows an error message. ========================================================================= Welcome to the Event Management System Please input today date (e.g. 01-jan-2020). 1 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at EventManagementSystem.Day.set(Day.java:48) at EventManagementSystem.Day.<init>(Day.java:62) at EventManagementSystem.SystemDate.<init>(SystemDate.java:6) at EventManagementSystem.SystemDate.createTheInstance(SystemDate.java:11) at EventManagementSystem.Main.main(Main.java:17) =========================================================================
if (this.isValidDay(sDayParts[0]) && this.isValidMonth(sDayParts[1]) && this.isValidYear(sDayParts[2]) && sDayParts.length == 3 ) change to if (sDayParts.length == 3 && this.isValidDay(sDayParts[0]) && this.isValidMonth(sDayParts[1]) && this.isValidYear(sDayParts[2]) )