22.5

Posted 功夫茶茶

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了22.5相关的知识,希望对你有一定的参考价值。

 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的主要内容,如果未能解决你的问题,请参考以下文章