JAVA中HashMap的成员遍历 方法一: Set entries; entries=map.keySet(); Iterator iter=entries.iterator(); while(iter.hasNext()){ Object obj=iter.next(); System.out.println(obj+":"+map.get(obj)); }
方法二: Set entries; entries=map.entrySet(); Iterator iter=entries.iterator(); while(iter.hasNext()) { System.out.println(iter.next()+" "); }
另外,JAVA中 interface和class都可以作为对变量的声明。
Powered by: BlogJava Copyright © 子非鱼