java question
This is probably a stupid mistake, but I keep getting the error message "ArrayIndexOutOfBoundsException" for this piece of code:
[PHP]public class map
{ public static void main(String args[])
{ int a[][] = new int[3][3];
a[3][0] = 5;
System.out.println(a[3][0]);
}
}[/PHP]
Can you help me out because this the first time I've written in java in over a year and am a little rusty?
[PHP]public class map
{ public static void main(String args[])
{ int a[][] = new int[3][3];
a[3][0] = 5;
System.out.println(a[3][0]);
}
}[/PHP]
Can you help me out because this the first time I've written in java in over a year and am a little rusty?
0
Comments
The reason it compiles is that there is nothing syntactically wrong with that code.
zz 0 1 2
0|* * *
1|* * *
2|* * *