public static void main(String[] args) throws IOException {
ArrayList<String> strList = new ArrayList<>();
BufferedReader in = new BufferedReader(new FileReader("demo13.txt"));
String row = null;
while((row = in.readLine()) != null){
strList.add(row);
}
in.close();
//遍历集合
for(String s : strList){
System.out.println(s);
}
} |
|