You created a scope.
incrementation of i variable must be executed in while loop.
In order to do this, write this:
int i = 0;
while (i<names.length)
{
if (names [i].equals(searchName)) {
foundName = true;
break;
}
i++;
}
pacior
On Jul 22, 10:04 pm, "David Seto" <[email protected]> wrote:
> Hello all on lab 1034 homework assignment
>
> When I run the program and type in the 1st name on the list "Beah" no
> problem.
>
> Name found on the list and the program is finished.
>
> When I rerun the program and type in the 2nd name on the list "Bianca" the
> program gets stuck .
>
> Here's part of the program does it have to deal with the location of the
> i++?
>
> int i = 0;
>
> while (i<names.length)
>
> if (names [i].equals(searchName)) {
>
> foundName = true;
>
> break;
>
> }
>
> {i++;
>
> }
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---