0
what is S:C here?
5 Answers
+ 2
for(String s:c) represents a for each loop. take a random String type variable, say s. for each time, an element contained in c, will b put into s, it will be printed out, one after the other in a loop.
+ 1
elaborate please, Where did you see that
+ 1
s is the String object while c is the LinkedList object.
0
Hey
0
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.remove("Green");
System.out.println(c);
}
}
ok if that's the thing bothering you
you can try doing thisāā(see code aboveāā)
the output will be same