This is tricky. Before 1.5, you could not do ap.add(10), you would have to do
ap.add(Integer.valueOf(10)); // OR
ap.add(new Integer(10));
This is called autoboxing and the compiler provides the extra code for you.
If you want to get it out as an int, you have to choices
1) Use generics
List<Integer> ap = new ArrayList<Integer>();
ap.add(10);
int ten = ap.get(0);
2) Cast
List ap = new ArrayList();
ap.add(10);
int ten = ((Integer)ap.get(0).intValue();