// Specify the full path to your file in here.
String datafile = "/home/rez/Desktop/data_example.txt";
double[][] mydata = FileReadingTools.getDoubleArray(datafile);
FileReadingTools给出错误 我想要一个工具来阅读桌面上的文本文件,如你所见
答案 0 :(得分:0)
只需使用:
public void read() {
String fileName = "your/path/yourFile.txt";
try {
List<String> lines = Files.readAllLines(Paths.get(fileName),
Charset.defaultCharset());
for (String line : lines) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}