Arrays in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Arrays in java

I have a Domino class and I want to creat an array holds all the 28 dominos in it so that I tried to code it like that Domino []game = new Domino []{ /* I need to use a loop to initialize all of my dominos but I found problem in it too , it's obligatory to use array */ } hope my Question is clear , please help me

2nd Jan 2019, 3:57 PM
Nadjet KERBOUCHE
1 Answer
0
You can write Domino[] game = new Domino[28]; then loop through with for loop for(int i = 0; i < game.length; i++){ game[i] = //whatever } if this is still relevant for you
4th Jun 2020, 9:22 AM
Matheon
Matheon - avatar