Sounds like a counting loop.
Here is a skeleton of the program:
class Searcher
{
// seek target in the array of strings.
// return the index where found, or -1 if not found.
public static int search( ____________ array, ____________ target )
{
. . . . . . // implement linear search
}
}
class SearchTester
{
public static void main ( String[] args )
{
final int theSize = 20 ;
String[] strArray = new String[ theSize ] ;
. . . . . . // put values into strArray
// call the static search method
int where = Searcher.search( strArray, "Peoria" );
if ( where >= 0 )
System.out.println("Target found in slot " + where );
else
System.out.println("Target not found" );
}
}