HashMap什么对象能做为key?

答:重写过hashCode和equals的对象,才能做为key,如果要将对象做为key,需要重写hashCode和equals。

null可以做为key值,null也可以做为value值。

猜你喜欢

转载自blog.csdn.net/china_3/article/details/84229845