-
Notifications
You must be signed in to change notification settings - Fork 0
/
AldhiyaInterface.java
64 lines (60 loc) · 1.05 KB
/
AldhiyaInterface.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
interface hewan
{
void makan();
void bernafas();
}
class harimau implements hewan
{
public void makan()
{
System.out.println("harimau sedang makan");
}
public void bernafas()
{
System.out.println("harimau sedang bernafas");
}
public void melahirkan()
{
System.out.println("harimau sedang melahirkan");
}
public void mencengkran()
{
System.out.println("harimau sedang mencengkram");
}
}
class ayam implements hewan
{
public void makan()
{
System.out.println("ayam sedang makan");
}
public void bernafas()
{
System.out.println("ayam sedang bernafas");
}
public void bertelur()
{
System.out.println("ayam sedang bertelur");
}
public void mematuk()
{
System.out.println("ayam sedang mematuk");
}
}
public class AldhiyaInterface
{
public static void main (String[] args)
{
harimau a = new harimau();
a.makan();
a.bernafas();
a.melahirkan();
a.mencengkran();
System.out.println("");
ayam b = new ayam();
b.makan();
b.bernafas();
b.bertelur();
b.mematuk();
}
}