7 AnswersNew 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 = 10; abc = 20; abc = 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. https://code.sololearn.com/co4xRMBPjQkS/?ref=app
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