Type mismatch: cannot convert from int to Object问题
问题描述:
int thistime = 0;
thistime = getRate(str1,thiskey);
ob1[1][1] = thistime;//将此数字存入数组
//上述行报错,如标题所示
object类作为父类,为什么不能接收此数字?
答
java语言不允许值类型存入Object,可以使用int的外覆类Integer
ob1[1][1] = new Integer(thistime);