0

I see besides the ability to increase the capacity, the other difference between an array and arraylist is that the latter does not allow the base type as primitive types. But since we have unboxing, which converts, saying, an Int type to Integer type, now arraylist can store any type. So why do we still need arrays?

  • 7
    To implement arraylist. :P – Seyf Nov 20 '14 at 15:30
  • 1
    Minor issue, you wrote *...we have unboxing, which converts, saying, an Int type to Integer type...* - other way around actually. [Unboxing](https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html) unwraps an Integer to its corresponding int value. – Paul Richter Nov 20 '14 at 15:33

1 Answers1

-2

Arrays are more efficient, because they have fixed size.

spongebob
  • 8,370
  • 15
  • 50
  • 83