I cannot figure out what to do. I keep getting an error because the array exceeds the bounds but I am not sure why. This is the latest instance of the code there have been many attempts.
private static String compareWords(String[] words) {
String longestWord = words[0];
for (int i = 0; i <= words.length; i ++){
while (longestWord.length()< words[i].length()){
longestWord=words[i];
}
}
return longestWord;
}