I want to search a multi-dimensional array and print the numbers greater than 7 with their locations.
This code compiles and runs without any errors, but doesn't provide any output.
Please help me to solve this problem.
class Sarr{
public static void main(String args[]){
int[][] numArray = {{1,2,5,6,4,0},{6,0,1,2},{1,7,3,4},{3,5,6,8,5}};
arr(numArray);
}
private static void arr(int [][] array){
int val = 7;
for (int r = 0; r < array.length; r++) {
for (int c = 0; c < array[r].length; c++) {
if (array[r][c] > val){
System.out.println("Value found was " + val + "["+r+"]"+"["+c+"]");
}
}
}
}
}
Value found was 7[3][3]