what would happen trying to run some code compiled in 1.5 that used the new ‘type checking’ style collections classes in java 1.4 VM?
ie. Java 1.4:
ArrayList oldList = new ArrayList();
oldList.add(“Hello”);
oldList.add(“there”);
Iterator i = oldList.iterator();
while(i.hasNext())
{
System.out.println((String)(i.next())
}
Java 1.5:
ArrayList newList = new ArrayList();
newList.add(“Hello”);
newList.add(“there”);
Iterator i = newList.iterator();
while(i.hasNext())
{
System.out.println(i.next())
}
seems to me that all it’s doing is making sure that you are only putting in a specific type at compile-time, which means you don’t have to cast it when you want to use it.
You have to compile with -target 1.4 to get it to run.