Case of Missing Runtime Error

I have this program when I have initialized with a generic type of Integer but not declared it with a generic type of Integer , when I try to add a String I don't get a compile error as expected , but I don't even get a runtime error when I run , what do you think is happening here ?

//Declaration with no ArrayList<Integer> al

ArrayList al = new ArrayList<Integer>();

al.add(45);

al.add("This string should not be here");

try

{

for (Iterator<Integer> i = al.iterator();i.hasNext();)

System.out.println("al[" + i + "]:" + i.next());

} catch (Exception e)

{

System.out.println("Message:" + e.getMessage());

}

[711 byte] By [insaneyogia] at [2007-11-27 4:37:24]
# 1

Well there's nothing there that tries to cast a list element to an Integer. This would throw a ClassCastException:

for (Integer integer : al)

{

System.out.println(integer.toString());

}

ejpa at 2007-7-12 9:47:38 > top of Java-index,Core,Core APIs...