public String GetValue(String key) {
for (int i = 1; i<=length; i++) {
if (key.equals(keyArr[i])) {
return valueArr[i];
}
}
}
public String GetKey(String value) {
String key;
for (int i = 1; i<=length; i++) {
if (value.equals(valueArr[i])) {
key = keyArr[i];
return key;
}
}
}
I get an error "this method must return a result of type string". But the two arrays valueArr and keyArr are both String type arrays. I know that the value of keyArr[i] and valueArr[i] are strings because if I change the return type of the method to something else it says that it expected something else and got a string.