Answer the question
In order to leave comments, you need to log in
Why swears at length?
When executing the code, it gives an error - /src/main/java/Kata.java:3: error: cannot find symbol
for(int i = 0; i < haystack.length(); i++){
^
symbol: method lenght()
location : variable haystack of type Object[]
Code:
public class Kata {
public static String findNeedle(Object[] haystack) {
for(int i = 0; i < haystack.length(); i++){
if(haystack[i] == "needle"){
return "found the needle at position " + i;
}
}
return "Makaron3000";
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question