-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimaldemo.java
43 lines (40 loc) · 873 Bytes
/
animaldemo.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
/**
* animaldemo
*/
interface basicanimal {
public void eat();
public void sleep();
}
class monkey {
public void jump() {
System.out.println("The monkey has jumped");
}
public void bite() {
System.out.println("The monkey has bitten")
}
}
class human extends monkey implements basicanimal {
public void eat() {
System.out.println("Human has eaten food");
}
public void sleep() {
System.out.println("Human has slept")
}
@Override
public void jump() {
System.out.println("The human has jumped");
}
@Override
public void bite() {
System.out.println("The human has bitten")
}
}
public class animaldemo {
public static void main(String[] args) {
monkey m = new human();
m.bite();
m.jump();
m.eat();
m.sleep();
}
}