Why would you use ArrayList? Is there a way to implement the same logic using just an ordinary array of int elements? What is the pros and cons in your decision?
Anonymous
Arrays don't have methods, ArrayList is a Class. Instances of ArrayList can contain all kinds of objects (depending on how they are declared). They have a good number of public methods for adding/retrieving/removing elements, and are generally a lot more powerful than arrays. In particular they re-size automatically to fit whatever number of elements you put in them, and "close up the gap" when you remove elements from the middle. In other side Array is faster than ArrayList.
Check out your Company Bowl for anonymous work chats.