[Solved] why do i have this infinite for loop


remove below code from toString()

    Scanner in = new Scanner(System.in);
    System.out.print("Enter a name: ");
    name = in.next();
    System.out.print("Enter a meal: ");
    mealType = in.next();

You are already reading these from the for loop.

Also, your do-while loop is all wrong. The condition doesn’t make sense. It should be option > 0 && option <4

3

solved why do i have this infinite for loop