📜  从文件到数组 java 代码示例

📅  最后修改于: 2022-03-11 14:52:19.064000             🧑  作者: Mango

代码示例3
BufferedReader abc = new BufferedReader(new FileReader(myfile));
List lines = new ArrayList();

while((String line = abc.readLine()) != null) {
    lines.add(line);
    System.out.println(data);
}
abc.close();

// If you want to convert to a String[]
String[] data = lines.toArray(new String[]{});