import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; public class zengzhiwei { public static void main(String agrs[]) { System.out.println("hello world!"); Map<String, String> m = new HashMap<String, String>(); m.put("zengzhiwei", "zzw"); m.put("zengzhijie", "zzj"); Set<String> s = m.keySet(); Iterator<String> itr = s.iterator(); while(itr.hasNext()) { Object o = itr.next(); System.out.println(m.get(o)); } List<Integer> l = new ArrayList<Integer>(); l.add(1); l.add(2); l.add(3); System.out.println(l.toString()); for (int i = 0; i < l.size(); i++) { System.out.println(l.get(i)); } } }
hello world! zzw zzj [1, 2, 3] 1 2 3
时间: 2024-10-26 20:15:53