-6

I am not able to make the difference between ArrayList and Array of objects in java. I am just a beginner. Also I am not able to understand that why Array is sorted by Arrays.sort and ArrayList is sorted by Collections.sort if both are array only.

9
  • 1
    google.co.uk/?gws_rd=ssl#safe=off&q=arraylist+vs+array+java Commented Feb 23, 2016 at 20:30
  • 1
    Hey Parth, definitely check out those links provided. There are several types of arrays, and they use different notions of natural ordering in sort. Commented Feb 23, 2016 at 20:31
  • 1
    As far as Java's concerned, they're nothing like the same type. ArrayList has an array in its implementation, but as far as Java's concerned that's the only overlap. Commented Feb 23, 2016 at 20:32
  • 1
    Collections is a class that can't be instantiated, so, neither. Collection is an interface. Commented Feb 23, 2016 at 20:34
  • 1
    @ParthPatel No, it just has a private constructor. Commented Feb 23, 2016 at 20:41

1 Answer 1

2

The short answer is arrays have a set size you define where as an arraylist has infinite size. You'll learn a lot about them from the api

https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Array.html

https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.