My Java compiler won't compile for statements like the following?

import java.util.*; public class IterateNoIndex { public void withoutIndex() { List<String> trees = Arrays.asList("Maple", "Birch", "Poplar"); for(String tree: trees){ System.out.println(tree); } The for loop causes an error. I am using jdk1.4.02 I am wondering... show more import java.util.*;

public class IterateNoIndex {

public void withoutIndex() {
List<String> trees = Arrays.asList("Maple", "Birch", "Poplar");
for(String tree: trees){
System.out.println(tree);
}




The for loop causes an error. I am using jdk1.4.02
I am wondering since there are several examples using similar loops. Even CoreJava has an example like this
2 answers 2