私はJavaにまったく慣れていないので、おそらくこれには簡単な説明があり、とにかく後はばかげていると思うでしょう。
メソッドを使用してファイルを読み取り、そのファイルデータから2D配列を入力してから、入力された配列を返して、メインクラスで使用できるようにし、そこから配列の内容を出力しようとしています。
これは私がこれまでに得たものです:
public class ScoreProcessor {
static public readFile() throws IOException {
File filedata = new File("src/JavaApp2/Data.txt");
Scanner file = new Scanner (filedata);
int row = 0, col = 0;
String[][] scores = new String[8][5];
while (file.hasNextInt()){
Scanner readfile = new Scanner (filedata);
readfile.nextLine();
readfile.useDelimiter(",");
while (readfile.hasNext(",")){
String line = readfile.next();
scores[row][col] = line;
col++;
}
row++;
col=0;
}
return scores;
}
}
どんな助けでもありがたいです、ありがとう。