C:\Documents and Settings\Chidimma\Desktop\Allfiles>javac TestLegacy.java
TestLegacy.java:5: non-static method iterator() cannot be referenced from a stat
ic context
Iterator it = List.iterator();
^
TestLegacy.java:8: cannot find symbol
symbol : method intValue()
location: class Integer
int i = ((Integer)it.next()).intValue();
^
TestLegacy.java:19: cannot find symbol
symbol : method add(int)
location: interface java.util.List<Integer>
myList.add(4);
^
TestLegacy.java:20: cannot find symbol
symbol : method add(int)
location: interface java.util.List<Integer>
myList.add(6);
^
.\Integer.java:9: cannot find symbol
symbol : constructor Integer()
location: class Integer
Integer y = new Integer();
^
.\Integer.java:11: cannot find symbol
symbol : method intValue()
location: class Integer
int x = y.intValue();
I guess you are not using any IDE to run this. I copied the code into Eclipse and changed compiler compliance level. I can see that 1.6 and 1.5 work just fine, but setting it to 1.4 shows problem in Eclipse for Integer.