I want to check if the two arrays have the same elements, but it says missing return statement although I have returned as below. What's the problem? My method can get correct value if I write in a void function.
public static boolean get(int[] One, int[] Two, int target) {
int [] temp = new int[One.length];
for (int i = 0 ; i < One.length; i ++){
temp[i] = target - One[i];
}
for (int m = 0; m < temp.length; m++){
for (int n = 0; n < Two.length; n ++){
if (temp[m]==Two[n]){
return true;
}
else return false;
}
}
}