haspmaps.java

来自「半年的java基础联系源码!现在看了破!对于初学java的朋友能帮上忙就用吧」· Java 代码 · 共 32 行

JAVA
32
字号
import java.util.*;
class HaspMaps
{
	public static void main(String[] args)
	{
		Map mp=new HashMap();
	        Integer i=new Integer(1);
		
			mp.put(i,"Mondy");
			mp.put(new Integer(2),"Tuestry");
			mp.put(new Integer(3),"WednesDay");
			mp.put(new Integer(4),"ThursDay");
			mp.put(new Integer(5),"Friday");
			mp.put(new Integer(6),"SaturDay");
			mp.put(new Integer(7),"SunDay");
		for(int j=1;j<=mp.size();j++)
		{
			System.out.println(j+":"+mp.get(new Integer(j)));
		}
		Set s1=mp.keySet();
		print(s1);
		Collection c1=mp.values();
		print(c1);
		System.out.println((String)mp.get(new Integer(3)));
	}
	public static void print(Collection c)
	{
		Iterator it=c.iterator();
		while(it.hasNext())
		   System.out.println(it.next());
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?