- 1
Please help me! I start something by didn't work
How to selec the only 4 character Strings within the LinkedList. import java.util.LinkedList; public class MyClass { public static void main(String[ ] args) { LinkedList<String> c = new LinkedList<String>(); c.add("Red"); c.add("Blue"); c.add("Green"); c.add("Orange"); c.add("Cocojambo") for(int i=0, i<c.length , i++) { if(c.get(i).length()>6){ System.out.println(c.add(i)); } } }
2 Answers
+ 2
fix ";"
```
import java.util.LinkedList;
public class Main {
public static void main(String[ ] args) {
LinkedList<String> c = new LinkedList<String>();
c.add("Red");
c.add("Blue");
c.add("Green");
c.add("Orange");
c.add("Cocojambo");
for(int i=0; i<c.size() ; i++) {
if(c.get(i).length()>6){
System.out.println(c.get(i));
}
}
}
}
```
0
I'm feeling shamed about my mistake. Thanks mate!