Can't get the new for loop to work

public class newforloop
public static void main(String args[])
String[]Student={"backpack", "id", "pencil"};
String word="";
for(String i:Student)//I get an error here
     if(i.equals("pencil"))
          word=i;
System.out.println(word);
I tried doing this at school and it worked but when I go home to fiddle around with it I get an error. I asked my friend and he said to update JAVA so I asked him which one do I download and he wasn't sure because download like everything. So my question is, what do i download? I see a whole bunch of things but I'm not really sure, and I don't want to download each and everyone one of those.
Im using JCreator.

I believe the "For every" loop was implemented in Java 5.0 .. so you probably have Java 5 on the school computer, but not on your home computer. Just download the Java 5 JDK from the downloads section.
http://java.sun.com/javase/downloads/index_jdk5.jsp

Similar Messages

Maybe you are looking for