Skip to content

Instantly share code, notes, and snippets.

@gusmantap
Created November 28, 2019 06:51
Show Gist options
  • Save gusmantap/25e443fd83db0a6a9e9b0ba611477568 to your computer and use it in GitHub Desktop.
Save gusmantap/25e443fd83db0a6a9e9b0ba611477568 to your computer and use it in GitHub Desktop.
class Hewan {
String nama;
String jenis;
public void Suara(){
System.out.println(this.nama+" Bersuara!");
}
}
class Unggas extends Hewan {
String keluarga;
}
class Burung extends Unggas {
public void Terbang(){
System.out.println(this.nama+" Terbang!");
}
}
class Kucing extends Hewan {
public void Lari(){
System.out.println("Lari!");
}
}
class Latihan81 {
public static void main(String [] args){
Burung elang = new Burung();
elang.nama = "Elang";
elang.Terbang();
Unggas ayam = new Unggas();
ayam.nama = "Ayam";
ayam.Suara();
Kucing mew = new Kucing();
mew.nama = "Mew";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment