+ 3
Java : why can’t I use sort in array but only in arraylist in JAVA?
why can’t I use sort in array but only in arraylist in JAVA? https://code.sololearn.com/c9s1nxo44lYl/?ref=app + The above code fails to deal with huge integers. Pls do suggest some modifications .
14 Respuestas
+ 2
Arrays.sort(arr) will sort your unsorted arr array
+ 3
ArrayList and array are different data structures. Cause arraylist isn't array, it is a list with indexes.
+ 2
~ swim ~ BigInteger was really helpful, thank you
+ 1
I am not sure about this, but I thought that arrays are immutuable.
+ 1
Another question guys,
Why does arraylists exists in java when array can do it all alone?
+ 1
Array has fixed size, Arraylist has variable size.
Means... If you create an array of 5 integers, you can never increase it to 6 or 7... Neither you can decrease it..
But in arraylist, you can always increase the size on requirement
+ 1
I think ArrayList are more flexible and interactive than arrays itself, for example when you used facebook the information that are displayed in your screen is through ArrayList.
0
Harin Mehta no, I think you are wrong here, check this out
int[] arr = new arr();
an array is defined which is not limited
0
Rafael Olivar your reference to facebook is a clean bouncer for me, but I appreciate your knowledge, Thank you
0
~ swim ~ Sorry but I need your help one last time,
Do I need to import some class or what because my code shows error on BigInteger part.
i suggest you chec out my code in the above post which i just edited, IFF posible.