+ 9
declaring array of string
I am trying to declare array of strings like this String[] password = new String[7]; and i recieve this error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7 at Program.main(Program.java:17) when i do the other way around String password[] = new String[7]; it still gives an error
4 Answers
+ 10
no i am trying to save 8 strings in this array through a loop... but it gives error when i try to declare it
+ 9
Thanks buddy it is working
+ 1
Thats the problem the size of array is 7 and you cant store 8 string....at 8th string (7 time of loop) You are using password[7] variable which doesn't exist....!
0
both are right...i think When you run the program You are forget that Index is from 0 so that last index is 6 not 7
.! for More Specify your question!