The problem is here:
for(int j=0;j<arr.length;j++)
You should actually be looping over the length of the inner array, not of the outer array. This should actually be
for(int j=0;j<arr[i].length;j++)
Edit: A key piece of information here is that you have an array of arrays. Your "outer" array has 3 items, each of which is itself an array of integers. To help understand this, try running the following code:
public class maximumNumber {
public static void main(String[] args) {
int arr[][] = {{11,21,31,32,33},{41,51,61,62,63},{71,81,91,92,93}};
int max = arr[0][0];
for(int i=0;i<arr.length;i++) {
int[] innerArray = arr[i];
System.out.println("------------------ Begin array " + i + " -----------");
for(int j=0; j< innerArray.length; j++) {
System.out.println(innerArray[j]);
if(arr[i][j]>max) {
max=arr[i][j];
}
}
System.out.println("------- End of array " + i + " --------");
}
System.out.println(max);
}
}
Here's the output:
------------------ Begin array 0 -----------
11
21
31
32
33
------- End of array 0--------
------------------ Begin array 1 -----------
41
51
61
62
63
------- End of array 1--------
------------------ Begin array 2 -----------
71
81
91
92
93
------- End of array 2 --------
93