ArrayList<String> arrayList = new ArrayList<>();
try {
File file = new File("E:\\new1.txt");
InputStreamReader inputReader = new InputStreamReader(new FileInputStream(file),"UTF-8");
BufferedReader bf = new BufferedReader(inputReader);
// 按行读取字符串
String str;
while ((str = bf.readLine()) != null) {
arrayList.add(str);
}
bf.close();
inputReader.close();
} catch (IOException e) {
e.printStackTrace();
}
后台代码