1.在右侧Begin-End区域中定义如下二维数组,使用for循环输出数组中所有的数据:
2.使用for循环将上述数组中的数据全部改为:
最后输出修改后scores数组中的数据。
package step4;
public class HelloWorld {
public static void main(String[] args) {
/********** Begin **********/
int [][] scores = {
{92,85},
{91,65},
{90,33}
};
for(int i = 0; i<scores.length; i++)
{
for(int j =0; j<scores[i].length; j++)
{
System.out.println(scores[i][j]);
scores[i][j]=j+1;
}
}
for(int i = 0; i<scores.length; i++)
{
for(int j =0; j<scores[i].length; j++)
{
System.out.println(scores[i][j]);
}
}
/********** End **********/
}
}
tips
1.每行的长度用scores[i].length
2.每列可以直接用整体的scores.length