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 < str.length; 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 < stu.length; 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); } }