It’s always returning false because list
is a List
and i
is an int
, so they can’t be equal, since they aren’t the same type.
You probably want to wrap a for loop around your search body
public static boolean search(int i) {
for(int item : list)
if(item == i) return true;
return false;
}
CLICK HERE to find out more related problems solutions.