Hi David,

The increment statement should be part of the while loop. In your program,
the block in which you have incremented the value of i will be unreachable.
The while loop runs infinitely for any value of name other than the 1st
name.

So, place the incrementation part inside the while loop and after the if
statement block.

Regards,
Babu

On Wed, Jul 22, 2009 at 11:34 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to