Home » , » contoh script java metode mutator dan asessor

contoh script java metode mutator dan asessor

class Mahasiswa{
//Properti
String NIM, nama;
double UTS, UAS;

//Metode Mutator
void setNIM(String NIM){
this.NIM = NIM;
}

void setNama(String nama){
this.nama = nama;
}

void setData(String NIM, String nama){
this.NIM = NIM;
this.nama = nama;
}

void setData(double UTS, double UAS){
this.UTS = UTS;
this.UAS = UAS;
}

//Metode Assesor
String getNIM(){
return this. NIM;
}

String getNama(){
return nama;
}

double getUTS(){
return UTS;
}

double getUAS(){
return UAS;
}
}

0 komentar:

Posting Komentar