Skip to content

Instantly share code, notes, and snippets.

@agusmakmun
Last active August 29, 2015 14:20
Show Gist options
  • Save agusmakmun/843ca4d91365024a7121 to your computer and use it in GitHub Desktop.
Save agusmakmun/843ca4d91365024a7121 to your computer and use it in GitHub Desktop.
Ini adalah class Mahasiswa sebagai induk utamanya.
/*
Ini adalah class Mahasiswa sebagai induk utamanya.
Lihat sub classnya (Account.java) : https://gist.github.com/agusmakmun/e7d8a4d2a566c5b7058d
Lihat pemanggilannya (aksesAccount.java) : https://gist.github.com/agusmakmun/1eaa4ee82bd094a9cf4d
@author Summon Agus (L200130113)
@blog bloggersmart.net
*/
public class Mahasiswa {
private String firstName, lastName, NIM, HBD, kelamin, alamat;
public Mahasiswa(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public Mahasiswa(String firstName, String lastName, String NIM,
String HBD, String kelamin, String alamat) {
this.firstName = firstName;
this.lastName = lastName;
this.NIM = NIM;
this.HBD = HBD;
this.kelamin = kelamin;
this.alamat = alamat;
}
protected void getFullName() {
System.out.print("Full Name: "+ firstName+" "+lastName); //tidak menggunakan println
}
public void infoMahasiswa() {
System.out.println("Nama : "+firstName+" "+lastName);
System.out.println("NIM : "+NIM);
System.out.println("HBD : "+HBD);
System.out.println("Kelamin : "+kelamin);
System.out.println("Alamat : "+alamat);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment