0

This bug was driving me nuts for the last two hours and I can't seem to figure it out, so here's the code:

int num_of_reservations = scanner.nextInt();
                Reservations[] business = new Buisness[num_of_reservations];
                for (int i = 0; i < business.length; i++) {
                    business[i] = new Buisness();
                }
                for (Reservations reservations : business) {
                    System.out.println("Write business member name: ");
                    String name_business = scanner.nextLine();
                    reservations.setName(name_business);
                }

the code was much more complicated but I tried to simplify it for easier understanding, this sample code produces the same unwanted output which you can see is skipping a scanner and going to the next println: enter image description here what could be causing this I can't seem to figure it out help me please.

Younis
  • 13
  • 1

0 Answers0