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;

}

}



Share this:

Enter your email address to get update from Kompi Ajaib.

Tidak ada komentar