问题描述:
java中个定义HashMap map = new HashMap();时,提示报错
说Hashmap不适用于int,char。
解决:
java中hashMap不能使用基本的数据类型,要使用相对应的引用类型(封装类),各个类型的对应关系如下:
原始类型 封装类
boolean Boolean
char Character
byte Byte
short Short
int Integer
long Long
float Float
double Double
京公网安备 11010502049817号