Hi, please help locate the problem in my code please | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Hi, please help locate the problem in my code please

public static void main(String args[]){ int arr[4]={2,11,45,9}; //i starts with 0 as array index starts with 0 too int i=0; while(i<4){ System.out.println(arr[i]); i++; } } }

29th Apr 2017, 10:41 AM
vincent beckham
vincent beckham - avatar
5 Réponses
+ 6
Don't know Java too much but you got three opening curly brackets here and four closing ones...
29th Apr 2017, 10:57 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
Check the number of paranthesis first.What was the error it showed after the compling the entire code?
29th Apr 2017, 1:56 PM
Sandeep Balachandran
Sandeep Balachandran - avatar
+ 1
I think the last curly bracket was for the class
29th Apr 2017, 11:27 AM
Mbonea Mjema
Mbonea Mjema - avatar
+ 1
what is the error?
29th Apr 2017, 11:28 AM
Mbonea Mjema
Mbonea Mjema - avatar
0
in which line
29th Apr 2017, 1:57 PM
Mbonea Mjema
Mbonea Mjema - avatar