Created
November 28, 2019 06:51
-
-
Save gusmantap/25e443fd83db0a6a9e9b0ba611477568 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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