mapdemo.java
来自「地图显示实例」· Java 代码 · 共 52 行
JAVA
52 行
/** * MapDemo.java * * $Id: MapDemo.java,v 1.1 2002/03/14 14:10:39 tmh Exp tmh $ * * $Log: MapDemo.java,v $ * Revision 1.1 2002/03/14 14:10:39 tmh * Initial revision * * Revision 1.1 2002/03/12 13:59:55 tmh * Initial revision * * **//** * Purpose: << You decide >> * * @author Trudy Howles tmh@cs.rit.edu ***/import java.util.*;public class MapDemo { public static void main (String args[] ) { Map m = new HashMap(); for (int i = 0; i < args.length; i++) { Integer frequency = (Integer) m.get (args[i]); if (frequency == null) { m.put (args[i], new Integer (1)); } else { m.put (args[i], new Integer (frequency.intValue() + 1)); } } System.out.println (m); }}// What is actually stored in the map? // Why don't these print in the order in which they were entered?// What is actually printed when the println() statement executes?
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?