I just get the time in HH:MM format and check if it is greater than 9:30 then count c is increased as 1.I just did for a single user input time.But i need to get multiple times from user and compare.If it is greater than 9:30 then increment the count values.First get n value and then get n no of time from user.How can i change my code to get the n no of time and compare that?
Scanner input = new Scanner(System.in);
String time = input.nextLine();
System.out.println();
int c=0;
String time2 = "9:30";
DateFormat sdf = new SimpleDateFormat("hh:mm");
Date d1 = sdf.parse(time);
Date d2 = sdf.parse(time2);
if(d1.after(d2))
{
c++;
}
System.out.println(c);