In the first line you're using the raw type ArrayList, without generics - that's why you get a warning. If you're using
Java 7, there's a third syntax you can use:
ArrayList<Integer> al = new ArrayList<>();
Note the <>. That's the so-called "diamond operator". It exists only to save you some typing - you don't need to type <Integer> twice, the compiler will figure out by itself that you mean <Integer>.