java中对于initializer的处理方式

    private static final HashMap hm = new HashMap();

    static {
        for (int i = 0; i < 10; i++) {
            hm.put(“test“, “this is value“);
        }
    }

同样的代码,在.net中就可以这么处理,假设class的名字是:Test
private static Hashtable ht;

static Test(){
    ht = new Hashtable();
    for(int i=0;i<10;i++)ht.Add(“test“,“this is value“);
}

posted @ 2004-04-21 13:08  鞠强  阅读(836)  评论(0编辑  收藏  举报

hello

world