03.02

contoh program java mahasiswa

public class Mahasiswa {
public int nim;
public String nama;
public Mahasiswa (int i, String n)
{
nim=i;
nama=n;
}
public int getNim(){
return nim;
}
public String getNama(){
return nama;
}

public static void main (String args[]){
Mahasiswa mhs =new Mahasiswa (12345,"Joko");
System.out.println("NIM:"+ mhs.getNim());
System.out.println("Nama:"+ mhs.getNama());
}
}

0 komentar:

Posting Komentar