错误❌的方法:1
2
3
4
5
6
7
81.
String[] A = new String[7]{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
2.
private int[][] m = new int[2][13]{
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
};
array creation with both dimension expression and initialization is illegal: ...
也就是,要么new int[][] ...
之后赋值;要么直接赋值。
正确✅的方法:1
2
3
4
5
6private int[][] m = {
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
};
String[] A = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};