我正在尝试制作二维数组。
这是代码: 公共类TwoDimensionalArray {
public static void main(String[] args) {
Integer str[][]=new Integer[3][3];
str [0][0]=10; the error is here 'cannot convert from int to integer'
答案 0 :(得分:0)
Integer和int是不同的数据类型。如果未指定,则该语言会将其假定为int。我将解决如下问题:
public static void main(String[] args) {
Integer str[][]=new Integer[3][3];
Integer myInt = 10;
str [0][0]=myInt;
}