-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e616d36
Showing
5 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package Tugas3; | ||
|
||
/** | ||
* | ||
* @author Achmad | ||
*/ | ||
public class Hewan extends MakhluqHidup { | ||
|
||
public Hewan(){ | ||
System.out.println("Hallo ini hewan"); | ||
|
||
} | ||
@Override | ||
public void berkembang() { | ||
System.out.println("berkembang dengan melahirkan"); | ||
} | ||
|
||
public void jenisMakanan() { | ||
System.out.println("Memakan Daging"); | ||
} | ||
|
||
public void jenisMakanan(String makanan) { | ||
System.out.println("Memakan " + makanan); | ||
} | ||
|
||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package Tugas3; | ||
|
||
/** | ||
* | ||
* @author Achmad | ||
*/ | ||
public abstract class MakhluqHidup { | ||
|
||
public abstract void berkembang(); | ||
|
||
public void bernafas(){ | ||
System.out.println("bernafas dengan organ paru-paru"); | ||
} | ||
public void bernafas(String nafas){ | ||
System.out.println("bernafas mengunakan "+nafas); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package Tugas3; | ||
|
||
/** | ||
* | ||
* @author Achmad | ||
*/ | ||
public class Mamalia extends Hewan { | ||
|
||
public Mamalia(){ | ||
System.out.println("Hallo ini Mamalia"); | ||
this.berkembang(); | ||
this.bernafas(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package Tugas3; | ||
|
||
/** | ||
* | ||
* @author Achmad | ||
*/ | ||
public class Tumbuhan extends MakhluqHidup { | ||
|
||
public Tumbuhan(){ | ||
System.out.println("Hallo ini Tumbuhan"); | ||
} | ||
@Override | ||
public void berkembang() { | ||
System.out.println("bekembang dengan penyerbukan"); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package Tugas3; | ||
|
||
|
||
public class Utama { | ||
public static void main(String[]Args){ | ||
|
||
Hewan kambing = new Hewan(); | ||
kambing.berkembang(); | ||
kambing.bernafas(); | ||
kambing.jenisMakanan("tumbuhan "); | ||
System.out.println(""); | ||
|
||
Tumbuhan jambu = new Tumbuhan(); | ||
jambu.berkembang(); | ||
jambu.bernafas("stomata"); | ||
System.out.println(""); | ||
|
||
Mamalia macan = new Mamalia(); | ||
macan.jenisMakanan(); | ||
|
||
} | ||
} |