-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop20.java
More file actions
44 lines (32 loc) · 728 Bytes
/
Copy pathoop20.java
File metadata and controls
44 lines (32 loc) · 728 Bytes
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
interface BasicAnimal{
void eat();
void sleep();
}
class monkey{
void jump(){
System.out.println("Jumping");
}
void bite(){
System.out.println("I will bite you");
}
}
class human extends monkey implements BasicAnimal{
public void eat(){
System.out.println("Eating");
}
public void sleep(){
System.out.println("Sleeping");
}
}
public class oop20 {
public static void main(String[] args) {
human human= new human();
BasicAnimal basicAnimal= new human();
human.jump();
human.bite();
human.eat();
human.sleep();
basicAnimal.eat();
basicAnimal.sleep();
}
}