개발/java
자바 생성자와 설정자
HEURISTIC_
2013. 10. 2. 17:27
package oop.instance;
public class Record {
int kor;
int eng;
int math;
public Record() //생성자
{
this.kor =2;
this.eng=3;
this.math=4;
}
public int total()
{
return this.kor + this.eng + this.math;
}
public int getKor() //설정자
{
return this.kor;
}
public int getEng()
{
return this.eng;
}
public int getMath()
{
return this.math;
}
public void setKor(int kor) //설정자
{
this.kor=kor;
}
public void setEng(int eng)
{
this.eng=eng;
}
public void setMath(int math)
{
this.math=math;
}
}