首页 > 其他 > 详细

22.5

时间:2016-11-12 19:54:46      阅读:166      评论:0      收藏:0      [点我收藏+]

技术分享

技术分享
 1 import java.io.File;
 2 import java.io.FileNotFoundException;
 3 import java.util.*;
 4 
 5 public class S22_5 {
 6 
 7     public static void main(String[] args) {
 8         // TODO Auto-generated method stub
 9         List<String> myList = new ArrayList<String>();
10     
11             Scanner input = null;
12             try {
13                 input = new Scanner(new File("txt.txt"));
14             } catch (FileNotFoundException e) {
15                 // TODO Auto-generated catch block
16                 e.printStackTrace();
17             }
18             while(input.hasNext()){
19                 myList.add(input.next());
20             }
21             Collections.sort(myList);
22             for(String list:myList)
23             System.out.println(list);
24     }
25 }
View Code

 

22.5

原文:http://www.cnblogs.com/wanjiang/p/6057243.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!