Declares list to be an array of 3 elements and initializes list[0] to 5, list[1] to 6, and list[2] to 3 (what's the error) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Declares list to be an array of 3 elements and initializes list[0] to 5, list[1] to 6, and list[2] to 3 (what's the error)

https://code.sololearn.com/cLQQ9Ci78VdC/?ref=app

29th Jan 2021, 6:50 PM
Alrabab Saeed
Alrabab Saeed - avatar
2 Answers
0
remove ; from the end of the for loop in line 10. public class Program { public static void main(String[] args) { int[]list = new int[3]; list[0] = 5; list[1] = 6; list[2] = 3; for(int x=0; x<3; x++) { System.out.println(list[x]); }//end for } }
29th Jan 2021, 7:17 PM
Rohit
+ 2
Just remove the semi-colon in for loop end statement.
29th Jan 2021, 7:19 PM
HBhZ_C
HBhZ_C - avatar