题目:
1.班上有3个学生,每个学生都参加了三门功课的考试,其中第二个学生是
特长生,上级要求给他每门功课都+5【要求:使用二维数组做,并且分别
使用for循环和增强for循环遍历二维数组】
答案:
public class test01{
public static void main(String[] args) {
int [][] arr = new int[3][3];
for (int i=0; i<arr.length; i++){
for (int j=0; j<3; j++){
if(i==1){
arr[i][j]=+5;
}
}
}
for (int[] ss : arr) {
for (int element : ss) {
System.out.println(element);
}
}
}
}