I need help with an error I'm getting while using if/else statements in a for loop.
This is my code up until now:
public class DD {
public static void main(String[] args) {
String[] name = {"naima", "rayan", "zakaria", "aliya", "hammad"};
String[] day = {"9", "23", "11", "21", "19"};
String[] month = {"3", "11", "6", "5", "7"};
String[] year = {"2021", "2021", "2021", "2021", "2021"};
System.out.println("Upcoming bookings: ");
for (int i = 0; i < day.length; i++) {
if (day[i] >= 21) {
System.out.println("Customer name: " + name[i]);
System.out.println("Date of booking: " + day[i] + "/" + month[i] + "/" + year[i]);
System.out.println("Number of People: " + "-");
}
else {
System.out.println("No bookings");
}
}
}
}
It is giving an error beside the if statement however there is no detail as to what the error is. Any help regarding the issue would be much appreciated.
Aucun commentaire:
Enregistrer un commentaire