package com.ww.yzpA;
public class Students {
int No;
int Height;
}
package com.ww.yzpA;
public class Height {
public Students getMaxHeigth(Students[] str) {
Students A = new Students();
for (int i = 0; i
if (str[i].Height > A.Height) {
A.Height = str[i].Height;
A.No = str[i].No;
}
}
return A;
}
}
package com.ww.yzpA;
import java.util.Scanner;
public class Text {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner (System.in);
Students [] stu = new Students[10];
Height news=new Height();
Students Stu=new Students();
for (int i = 0; i
System.out.println("请输入第"+(i+1)+"位学员的身高:");
stu[i]= new Students();
stu[i].Height=in.nextInt();
stu[i].No=i+1;
}
Stu=news.getMaxHeigth(stu);
System.out.print("该班第"+Stu.No+"名学生身高最高,为"+Stu.Height);
}
}