void searchForPopulationChange()
{
String goAgain;
int input;
int searchCount = 0;
boolean found = false;
while(found == false){
System.out.println ("Enter the Number for Population Change to be found: ");
input = scan.nextInt();
for (searchCount = 0; searchCount < populationChange.length; searchCount++)
{
if (populationChange[searchCount] == input)
{
found = true;
System.out.print(""+countyNames[searchCount]+" County / City with a population of "+populationChange[searchCount]+" individuals\n");
}
}
}
}
}
你好!我正在研究一种方法,该方法将接受用户输入,比如说(5000)并使用这些相应的数字搜索数据文件。并返回对应的数字和对应的县。
但是,我可以让这段代码运行以返回正确的值,但是当我输入“不正确”的值时,我无法让它运行。
任何指针?谢谢!