What is array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What is array?

how we can declar an array?

19th Nov 2018, 7:06 AM
Neda Rezaie
4 Answers
+ 3
آرایه، مجموعه ای از دیتاتایب های مشابه می‌باشد. مثلا: { 1, 2 , 3, 4...} طریقه تعریف: Int [] nums = new int [10];
19th Nov 2018, 7:25 AM
Yaseen Akbari
Yaseen Akbari - avatar
+ 1
Its a collection of certain data type under same variable int[5]arr; //it'll declare an array of int with size of 5, named arr
19th Nov 2018, 7:09 AM
Taste
Taste - avatar
+ 1
thanks
19th Nov 2018, 7:13 AM
Neda Rezaie
+ 1
You might have heard that array store values of same type under same name. But this is not actually true in Java. In Java when you declare an array of type Object you can store values of different types also. So in context of Java...the correct definition of array would be "an array is a data structure which stores elements of same or different types at contiguous location" Note that the word contiguous is important
19th Nov 2018, 9:06 AM
Rishi Anand
Rishi Anand - avatar