You are on page 1of 1

====================== Indrawan Dwi Suyanto 30111589 PIS 11-11 ====================== 1.a.

// kelas person package person; /** * * @author INDRAWAN */ public class Person { String nama; public Person(String nama){ this.nama=nama; } public void tampildata(){ System.out.println("Nama : " + nama); } } // kelas mahasiswa public class mahasiswa extends Person{ String nim; public mahasiswa(String nama,String nim){ super(nama); this.nim = nim; } public void tampildata(){ System.out.println("nama " + nama); System.out.println("NIM " + nim); } } //main public class main { public static void main(String[] args) { Person ps = new mahasiswa("Albert Einstein","61309001"); ps.tampildata(); } } b. -konseop inheritence -konsep virtual method invocation c. -kelas mahasiswa mewarisi kelas person