Just write ArrayList list = new ArrayList();
It'll be create a new Object instance of ArrayList. ArrayList has 3 constructor, the one who interest you is the previous, because u want a size of n (it should be better to declare a size if u know the size u want, cuz of optimisation and speed). Each time u'll put an Object in your ArrayList, they'll increase the size automatically.
By the way, if u want to suppress element, make sure to also resize the ArrayList.
And u wouldn't need a for anymore, you can work with, but it's not necessary.
This post was edited by Bremen on Nov 18 2012 03:58pm