Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Hondo Chalthoum    on Dec 18 In Java Category.

  
Question Answered By: Julio Morgan   on Dec 18

Yes there is. The usage is:
int[][] ints = new int[20][20];
for(int i = 0; i < ints.length; i++)
for(int ii = 0; ii < ints[i].length; ii++)
//Do your stuff

The main thing here is that ints[i] returns an int [] and not an int
itself. So the first for-loop is to walk through all the arrays and
the second for-loop is to walk through the array  itself.

Share: