What is wrong with this sequential search? m_t3[] is an integer array with some combination of the numbers 0, 1, and 4 filling it. (The size of the array is 9). NetBeans giving me an error message, incomparable types: int[] and int. The examples I’ve seen for this type of search look like this though.
int key = 0;
boolean cat = false;
for (int i = 0; i < m_t3.length; i++) {
if (m_t3[i] == key) {
cat = true;
break;
}
}
The only line that could be problematic in your code is
It seems that your
m_t3is as an array of arrays and not a simple array. Double-check your declaration.