📄 exercise18_5.java
字号:
import java.util.*;import java.io.*;public class Exercise18_5 { public static void main(String[] args) { if (args.length != 1) { System.out.println( "Usage: java Exercise18_5 fullfilename"); System.exit(0); } String filename = args[0]; // Create a list to hold the words ArrayList list = new ArrayList(); try { BufferedReader in = new BufferedReader(new FileReader (filename)); String line; while ((line = in.readLine()) != null) { StringTokenizer st = new StringTokenizer(line, " \n\t\r.,)(-\""); while (st.hasMoreTokens()) list.add(st.nextToken()); } } catch (Exception ex) { System.err.println(ex); } // Get an iterator for the list Collections.sort(list); Iterator iterator = list.iterator(); // Display mappings System.out.println("\nDisplay words in ascending order "); while (iterator.hasNext()) { System.out.println(iterator.next()); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -