import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;

 public class TxtLoad {
     public static void main(String[] args) {
         try {
             String uri = "X:\\file.txt";
             List<String> list = new ArrayList<String>();
             File file = new File(uri);
             FileInputStream fis = new FileInputStream(file);
             InputStreamReader isr = new InputStreamReader(fis);
             BufferedReader br = new BufferedReader(isr);
             String str = "";
             while ((str=br.readLine()) != null) {
                 list.add(str);
             }
             Collections.shuffle(list);
         } catch (FileNotFoundException e) {
             e.printStackTrace();
         } catch (IOException e) {
             e.printStackTrace();
         }
     }
 }

冰剑
898 声望26 粉丝

轻击键盘,静侯回音。