Java面试-map集合,map的键可以为空
package com.picchealth.hmbms.utils.export; import java.util.HashMap; /** * Created by zyq on 2020/7/31. */ public class HashMapTest { public static void main(String[] args) { HashMap hm=new HashMap(); hm.put(null,"q"); Object o = hm.get(null); System.out.println("========="+o.toString()); } }
程序运行结果:
=========q