I need help seeing the 7 errors in this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need help seeing the 7 errors in this code

public class ErrorExam2 { public static void main(String arg[]) { int values[] = new int[3][4]; int x = 1; for(int i=0; i<=3; i++) { for(int j = 0 ; j < 4; j++) { values[i][j] == x; x *=2; } } for(i=0; i<=3; i++) { for(j = 0 ; j < 4; j++) { System.out.print(values[i][j]" "); } System.out.println(); } } }

11th Jul 2018, 4:13 AM
Amon Kimutai
Amon Kimutai - avatar
1 Answer
+ 1
In array indexing starts from 0 so in the first for loop you are exceeding the limit of space what you declared that is i<3 not i<=3
11th Jul 2018, 4:37 AM
anwesh jami
anwesh jami - avatar