+ 1

What is the best way to create an array?

FORM 1- // Create an array of integers with the ability to store 5 items int[] n = new int[5]; // Initialize the array by assigning each position a unique value n[0] = 2; n[1] = 56; n[2] = 777; n[3] = 0; n[4] = -55; FORM 2 (array literal)- // Declare and initialize an array int[] n = {2, 56, 777, 0, -55};

6th Aug 2019, 2:09 PM
Juan Debenedetti
Juan Debenedetti - avatar
5 Answers
+ 4
6th Aug 2019, 3:09 PM
BroFar
BroFar - avatar
+ 4
look in the array section of the Java fundamental tutorial https://www.sololearn.com/learn/Java/2148/
6th Aug 2019, 2:35 PM
BroFar
BroFar - avatar
+ 4
Juan Debenedetti you can always go to the code playground of past codes and select language and type in - like in this case array or arrays and see how others have used them in their codes directly... use their experience as your guide.
6th Aug 2019, 2:50 PM
BroFar
BroFar - avatar
+ 2
BroFarOps Thanks!
6th Aug 2019, 3:20 PM
Juan Debenedetti
Juan Debenedetti - avatar
+ 1
BroFarOps yes, I understand the issue of arrays well, I wanted a more personal response.
6th Aug 2019, 2:46 PM
Juan Debenedetti
Juan Debenedetti - avatar