public class Names {
/**
* @param args
*/
public static void main(String[] args) {
String[][] name = { { "李四", "王五" }, { "green", "B", "XiaoMing" } }; // A班三个人,B班两个人
int[][] scores = { { 90, 98 }, { 45, 90, 95 } };
for (int i = 0; i < scores.length; i++) {
for (int j = 0; j < scores[i].length; j++) { //注意这里的循环中止条件是i<scores[i].length,而不是scores.length,否则会造成最后一会无法取得其值
if (scores[i][j] > 85) {
System.out.println(name[i][j] + "," + scores[i][j]);
}
}
}
String name2[][] ={{"张三","王五"},{"李四","白晶","黑仔"}};
int score[][]={{80,90},{95,95,100}};
System.out.println("输出成绩大于80分的学生姓名和分数:");
for(int i=0;i<score.length;i++){
for(int j=0;j<score[i].length;j++){
if(score[i][j]>85){
System.out.println(name2[i][j]+"---"+score[i][j]+"分");
}
}
}
}
}
/**
* @param args
*/
public static void main(String[] args) {
String[][] name = { { "李四", "王五" }, { "green", "B", "XiaoMing" } }; // A班三个人,B班两个人
int[][] scores = { { 90, 98 }, { 45, 90, 95 } };
for (int i = 0; i < scores.length; i++) {
for (int j = 0; j < scores[i].length; j++) { //注意这里的循环中止条件是i<scores[i].length,而不是scores.length,否则会造成最后一会无法取得其值
if (scores[i][j] > 85) {
System.out.println(name[i][j] + "," + scores[i][j]);
}
}
}
String name2[][] ={{"张三","王五"},{"李四","白晶","黑仔"}};
int score[][]={{80,90},{95,95,100}};
System.out.println("输出成绩大于80分的学生姓名和分数:");
for(int i=0;i<score.length;i++){
for(int j=0;j<score[i].length;j++){
if(score[i][j]>85){
System.out.println(name2[i][j]+"---"+score[i][j]+"分");
}
}
}
}
}