Skip to content

Instantly share code, notes, and snippets.

@griajobag
Created May 12, 2018 02:29
Show Gist options
  • Save griajobag/40c889e87a33ccbf5d734e524a7716fa to your computer and use it in GitHub Desktop.
Save griajobag/40c889e87a33ccbf5d734e524a7716fa to your computer and use it in GitHub Desktop.
Inheritance
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package hs;
/**
*
* @author androidbie.com
*/
public class Main {
public static void main(String[] args) {
//kita panggi si sub classnya
// #1
Employee pg = new Employee("Anree", "21", "Front Office");
pg.setHospitalName("Hospital ABC"); //method super class
pg.setHospitalAddress("Victoria Street No 78"); //method superclass
//#2
Employee pg1 = new Employee("John A", "26", "Doctor Specialist");
pg1.setHospitalName("Hospital GGG"); //method super class
pg1.setHospitalAddress("Roma, Italy"); //method superclass
//Show ID Card #1
System.out.println("ID Card");
System.out.println("");
System.out.println("Employee Name : \t\t" + pg.getEmployeeName());
System.out.println("Title : \t\t" + pg.getEmployeeTitle());
System.out.println("Hospital Name :\t" + pg.getHospitalName());//method superclass
System.out.println("Hospital Address :\t"+ pg.getHospitalAddress());//method superclass
System.out.println("");
System.out.println("");
//Show ID Card #2
System.out.println("ID Card");
System.out.println("");
System.out.println("Employee Name : \t\t" + pg1.getEmployeeName());
System.out.println("Title : \t\t" + pg1.getEmployeeTitle());
System.out.println("Hospital Name :\t" + pg1.getHospitalName());//method superclass
System.out.println("Hospital Address :\t"+ pg1.getHospitalAddress());//method superclass
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment