【发布时间】:2015-10-06 23:18:44
【问题描述】:
我有一个包含这些值的 5x5 表格的文本文档
5 5
39 95 99 56 41
88 8 1 48 75
3 58 13 54 80
92 72 74 25 86
30 38 3 21 2
我必须将它们添加到一个数组中,并显示最小值(即 1)并告诉最小值的位置(第 1 行第 2 列)。
public static void main(String[] args)
{
Scanner input;
File fileIn = new File("src/array2d/array2dtest1.txt");
System.out.println(fileIn.getAbsolutePath());
int[][] array = new int[5][5];
for(int row = 0;row<array.length;row++) {int[] column = array[row];
{
for(int columnIndex = 0; columnIndex<column.length; columnIndex++);
}
}
try
{
input = new Scanner(fileIn);
}
catch (FileNotFoundException e)
{
System.out.println(fileIn.getName() + " is not found.");
return;
}
input.close();
}
}
【问题讨论】: