📜  如何将行转换为字符串java代码示例

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

代码示例1
File file = new File(fileName);
Scanner input = new Scanner(file);
List list = new ArrayList();

while (input.hasNextLine()) {
    list.add(input.nextLine());
}

//adds each line of a text file into an ArrayList