为什么先分配空间再赋值就错了呢
String[][] names= new String[2][3];
names={{"tom","jack","mike"},{"zhangsan","lisi","wangwu"}};
这样写直接报错
改成
String[][] names={{"tom","jack","mike"},{"zhangsan","lisi","wangwu"}};
这样就没问题了。
求大佬告知,是new的问题吗还是
String[][] names= new String[2][3];
names={{"tom","jack","mike"},{"zhangsan","lisi","wangwu"}};
这样写直接报错
改成
String[][] names={{"tom","jack","mike"},{"zhangsan","lisi","wangwu"}};
这样就没问题了。
求大佬告知,是new的问题吗还是
2019-03-19
举报