개발/java
자바 성적관리프로그램 (Record부분)
HEURISTIC_
2013. 10. 1. 17:54
package oop.capsule; public class Record { int kor; int eng; int math; public static int total(Record record) { return record.kor + record.eng + record.math; } public static int getKor(Record record) { return record.kor; } public static int getEng(Record record) { return record.eng; } public static int getMath(Record record) { return record.math; } public static void setKor(Record record,int kor) { record.kor=kor; } public static void setEng(Record record, int eng) { record.eng=eng; } public static void setMath(Record record, int math) { record.math=math; } }* 다른곳에서 필드명이 쓰일경우 수정의 어려움이 있어 Record 클래스안에서 모든걸 정의함 (수정의 용이함)