解答例 - j2.lesson02_2.ExamRecord5Action

package j2.lesson02_2;

public class ExamRecord5Action {
    public static void main(String[] args) {
        ExamRecord5[] rec = new ExamRecord5[4];
        rec[0new ExamRecord5("Taro"100150901004090);
        rec[1new ExamRecord5("Hanako"100270308010070);
        rec[2new ExamRecord5("Kenji"10036050706080);
        rec[3new ExamRecord5("Aya"100440100905055);
        
        ExamRecord5.sortByMath(rec);
        System.out.println("===数学の点数順に並べると===");
        for(int i=0; i<rec.length; i++){
            System.out.println(rec[i].name + ", id=" + rec[i].id +
                    ", math=" + rec[i].ma);
        }
        
        ExamRecord5.sortByTotal5(rec);
        System.out.println("===5科目の合計点の順に並べると===");
        for(int i=0; i<rec.length; i++){
            System.out.println(rec[i].name + ", id=" + rec[i].id +
                    ", total5=" + rec[i].getTotal5());
        }
    }
}