1
我正在研究一个项目,该项目让我扫描数字1-9,然后将它们存储在一个数组中,同时检查重复项。我可以得到除了必须检查重复部分的部分之外的所有内容。有没有简单的方法比较1号码与整个阵列?将int与数组进行比较java
ex. int[] array = new int[9];
array[0] = 0;
array[1] = 1;
array[2] = 2;
array[3] = 3;
array[4] = 4;
then user inputs 3, how can I check the entire array for 3?
检出:http://stackoverflow.com/questions/1128723/how-can-i-test-if-an-array-contains-a-certain-value – roger
可能的重复[如何测试如果一个数组包含一定的值?](http://stackoverflow.com/questions/1128723/how-can-i-test-if-an-array-contains-a-certain-value) –
@ABusyProgrammer不是真的重复,因为这个问题是关于一个'String'数组的,而且大多数的回答都不适用于像'int'这样的基本数组。 –