What's is wrong in my code?
I'm trying solve task in java course at Linked list. This is that code: import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[ ] args) { Scanner scanner = new Scanner(System.in); LinkedList<String> words = new LinkedList<String>(); while(words.size()<5){ String word = scanner.nextLine(); //add the word to LinkedList words.add(word); } //your code goes here for (int i=0;i<=words.size();i++){ word = words.get(i); if (word.lenght() > 4){ System.out.println(word);} } } } Have You some idea? On margin I say that code from "solution" from Sololearn either doesn't work (at least for me). You can check.