Arrays and lists/ Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Arrays and lists/ Java

Ok, I AM NEW TO JAVA AND, (SORRY IF THIS SEEMS YELLING) IdK WHAT IS ARRAYS AND LISTS. I KNOW THAT LISTS ARE HERE TO ORDER, LIKE 123, OR ABCS. BUT WHAT DO ARRAYS DO? I HaVE NO IDEA, AND, ALWAYS THX FOR YOUR TIME TO ANSWER.

2nd Aug 2020, 1:15 AM
Mandy Huang
Mandy Huang - avatar
2 Answers
+ 4
Array is a fixed length data structure whereas ArrayList is a variable length Collection class. We cannot change length of array once created in Java but ArrayList can be changed. We cannot store primitives in ArrayList, it can only store objects. But array can contain both primitives and objects in Java
2nd Aug 2020, 1:55 AM
Aayush $aini
Aayush $aini - avatar
0
variable stores one value; array or list can store more values of the same type and usually same purposes, eg list of students, list of books, words, characters, numbers. then you can fast address the value, change it, and easy iterate all vales.
2nd Aug 2020, 5:13 AM
zemiak