6.Write a procedure that receives a two dimensional array that has been filled with integers.Use 请解释每步的意思Write a procedure that receives a two dimensional array that has been filled with integers.Use two “for loops” to search thro

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 17:28:11

6.Write a procedure that receives a two dimensional array that has been filled with integers.Use 请解释每步的意思Write a procedure that receives a two dimensional array that has been filled with integers.Use two “for loops” to search thro
6.Write a procedure that receives a two dimensional array that has been filled with integers.Use
请解释每步的意思
Write a procedure that receives a two dimensional array that has been filled with integers.Use two “for loops” to search through the array to find any value greater than 7.When a value is found that is greater than 7 then the value and its location within the array must be printed to the screen.(“Value found was “7” at [1][3]”).

6.Write a procedure that receives a two dimensional array that has been filled with integers.Use 请解释每步的意思Write a procedure that receives a two dimensional array that has been filled with integers.Use two “for loops” to search thro
public class Finder {

public static void find(int[][] d){
for(int i = 0;i < d.length; i++){
for(int j = 0;j < d.length;j++){
if(d[i][j] > 7){
String s = "Value found was 7 at "
+ "[" + i + "]" + "[" + j + "]";
System.out.println(s);
}
}
}
}

public static void main(String[] args) {
int[][] test = {
{
7,8,9,10,11
},
{
7,8,9,10,11
},
{
7,8,9,10,11
},
{
7,8,9,10,11
},
{
7,8,9,10,11
},
};
Finder.find(test);
}
}