Hi, this has been reviewed many times I ques, but lets make it on more time :) I am a little confused working with a 2d array, I seem to have mised something how it calculate the length. I thought my code where correct but i get the famous out of bounds on index 5. I am stumbling in the dark, give me a hint, but not a working code please.
My code
public String addString (String in_array[] [], String in_name) {
//test
//length=in_array.length;
for (int row=0; row<in_array.length; row++) {
for (int col=0; col<in_array[row].length; col++) {
in_array[vertCount][hortCount]=in_name;
//Increment position value
vertCount++;
hortCount++;
//debug
System.out.print(in_array[row] [col] +" ");
}
}
return in_name;
}
Remember, no code, just a hint.
Martin