zoukankan      html  css  js  c++  java
  • JAVA-2.2-homework

    package Ac;
    
    import java.util.*;
    
    public class Test {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            show();
        }
        public static void show() {
        Map a = new HashMap();
        a.put("欧欧","Q仔");
        a.put("亚亚","Q妹");
        a.put("菲菲","Q妹");
        a.put("美美","Q妹");
        System.out.println("共计有"+a.size()+"只企鹅");
        Set keys = a.keySet();
        Iterator it = keys.iterator();    
        System.out.println("分别是:");
       while (it.hasNext()) {
           String key = (String)it.next();
           String b = (String) a.get(key);
           System.out.println(key+"	"+b);
        }
        }
    }
    package Ac;
    
    import java.util.*;
    
    public class Test {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            show();
        }
        public static void show() {
            Map<String,String> a = new HashMap<String,String>();
            a.put("欧欧","Q仔");
            a.put("亚亚","Q妹");
            a.put("菲菲","Q妹");
            a.put("美美","Q妹");
            System.out.println("共计有"+a.size()+"只企鹅");
            System.out.println("iterator输出");
            //iterator输出
            Set<String> keys = a.keySet();
            Iterator<String> it = keys.iterator();    
            System.out.println("分别是:");
            while (it.hasNext()) {
                String key = (String)it.next();
                String b = (String) a.get(key);
                System.out.println(key+"	"+b);
            }
            System.out.println("foreach语句输出");
            //foreach语句输出
            for (String key : keys) {
                String b = a.get(key);
                System.out.println(key+"	"+b);
            }
        }
    }
  • 相关阅读:
    Xamarin和微软发起.NET基金会
    迷你 MVC
    编制进度计划、保存基准
    JQuery UI Layout Plug-in布局
    (转载)Log4Net 在多层项目中的使用小记
    Json.Net6.0
    EasyUI搭建前端框架
    using和yield return
    ExpandoObject,DynamicObject,DynamicMetaObject
    Net 4.0 之 Dynamic 动态类型
  • 原文地址:https://www.cnblogs.com/yunlan/p/13100013.html
Copyright © 2011-2022 走看看