public static void main(String[] args) {
try {
File file = new File("E:\\a.txt");// 创建文件对象
BufferedReader br = new BufferedReader(new FileReader(file)); // 创建读取流
List LinkedList=new ArrayList();
// 读取数据
String temp;
while ((temp = br.readLine()) != null) {
LinkedList.add(temp);
}
for(int i=LinkedList.size()-1;i>=0;i--){
System.out.println(LinkedList.get(i));
}
} catch (Exception e) {
e.printStackTrace();
}
}
给分吧
public static void main(String[] args) {
String line;
LinkedList linkList = new LinkedList
File file = new File("D:\\test.txt");
try {
BufferedReader in = new BufferedReader(new FileReader(file));
while (line = in.readLine()) != null) {
linkList.add(line);
}
for(int i=linkList.size()-1;i>=0;i--){
System.out.println(linkList.get(i));
}
} catch (Exception e) {
e.printStackTrace();
}
}