如题所述
第1个回答 2015-12-10
public static List<String> readFile(String path){
File f = new File(path);
BufferedReader br = null;
List<String> list = new ArrayList<String>();
try {
br = new BufferedReader(new FileReader(f));
String content = null;
while (true) {
content = br.readLine();
if(content == null){
break;
}
list.add(content);
}
} catch (Exception e) {
// TODO: handle exception
}
return list;
}本回答被网友采纳
File f = new File(path);
BufferedReader br = null;
List<String> list = new ArrayList<String>();
try {
br = new BufferedReader(new FileReader(f));
String content = null;
while (true) {
content = br.readLine();
if(content == null){
break;
}
list.add(content);
}
} catch (Exception e) {
// TODO: handle exception
}
return list;
}本回答被网友采纳