Why doesn't my date validation code work?
my code doesn't return any value and i have no idea why. My assignment requires me to write a code that accepts date in mm/dd/yyyy format and im required to put leap year in. The problem is, i dont get back any input. Im an amateur ad i dont know what is wrong. Im also allowed to use Case statement but I'm not sure how to implement case. The problem i hvae is, there is no input. Literally non. import java.util.Scanner; public class Question1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in).useDelimiter("/"); System.out.println("Please enter a date in mm/dd/yyyy format: "); String mm = sc.next(); String dd = sc.next(); String yyyy = sc.next(); int month = Integer.parseInt(mm); int day = Integer.parseInt(dd); int year = Integer.parseInt(yyyy); if (month <= 0 && month>12) { System.out.println("invalid month "); } if (year%4 != 0 && month == 02 && day >= 29) { System.out.println("invalid date"); } if (month == 4 && month == 6 && month == 9 && month == 11 && day >= 31) { System.out.println("Invalid day"); } if (month == 1 && month == 3 && month == 5 && month == 7 && month == 8 && month == 10 && month == 12 && day >=32 ) { System.out.println("Invalid day"); } else { System.out.println("Valid date"); } } }