Is there a way to check index/position in a two dimensional array? for java -
Is there a way to check index/position in a two dimensional array? for java -
if build 2 dimensional array such
object[][] myarray = new object[5][5];
and used loop traverse array, there way check if current position index?
like
if(myarray[3][4]) { ..... }
like this?
for(int = 0; < myarray.length; i++) { object[] row = myarray[i]; for(int j = 0; j < row.length; j++) { object o = row[j]; foo(o); if(i == 3 && j == 4) bar(o); } }
but why want on calling bar(myarray[3][4])
after looping?
java arrays
Comments
Post a Comment