Student

public class Student {
//フィールド宣言
String name; // 氏名
int tens; // 試験の点数

///////////////////////////////
//同じ名前のメソッドであっても引数違うので、
//違うメソッドとして扱われる。
///////////////////////////////
//Studentメソッド(引数,引数)
///////////////////////////////

public Student(String name, int tens) {
this.name = name;
this.tens = tens;
}

///////////////////////////////
//Studentメソッド(引数,引数,引数,引数)
///////////////////////////////

public Student(String name, int x, int y, int z) {
this.tens = new int[3];
this.name = name;
this.tens[0] = x;
this.tens[1] = y;
this.tens[2] = z;
}

///////////////////////////////

public String toString() {
String s = "[" + name;
for (int i = 0; i < tens.length; i++) {
s += "," + tens[i];
}
s += "]";
return s;
}

///////////////////////////////

public int total() {
int sum = 0;
for (int i = 0; i < tens.length; i++) {
sum += tens[i];
}
return sum;
}

///////////////////////////////

}