Arrays | Sololearn: Learn to code for FREE!



I don't understand the arrays statements at all... can you please explain? I didn't understand the explanation in Sololearn also...

3/11/2020 7:06:22 PM


7 Answers

New Answer



Arrays are nothing but objects. In Java you have 8 primitive data types and the rest are reference types. Arrays can hold any of these types. In order to declare an Array, you just have to write the below line- Type[ ] array_name = new Type[size]; // this is called array declaration. You can replace the Type with anything, it could be either primitive types, wrapper classes or even user defined types. A simple example would be- int[ ] abc = new int[ 5 ]; Here you have created an integer type array which can store 5 values of integer type only. To store values you can do- abc[0] = 10; abc[1] = 20; abc[2] = 30; etc... Always remember array indexing starts from 0 so the above array can hold indexes from 0 to 4 which are totally 5 in number.


Avinesh it's a little bit too complicated... I will search it up more later... if I won't understand by then I will tag you in this post.. ty


yahel See if this helps.


yahel good to hear that ๐Ÿ‘


Avinesh thank you for helping so far. Can you please put a simple example in a document (sololearn) and I will see how the output worked and everything...


Avinesh I figured it out.. I checked on YouTube... ty