-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_60.java
More file actions
49 lines (49 loc) · 1013 Bytes
/
Main_60.java
File metadata and controls
49 lines (49 loc) · 1013 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
45
46
47
48
49
abstract class Pen{
abstract void write();
abstract void refill();
}
class FountainPen extends Pen{
void refill() {
System.out.println("refill");
}
void write() {
System.out.println("write using pen");
}
void change(){
System.out.println("change nip");
}
}
class Monkey implements Animal{
void jump(){
System.out.println("jumping");
}
void bite(){
System.out.println("biting");
}
public void eat() {
System.out.println("eating");
}
public void sleep() {
System.out.println("sleeping");
}
}
class Human extends Monkey{
void speak(){
System.out.println("hello");
}
}
interface Animal{
void eat();
void sleep();
}
public class Main_60 {
public static void main(String[] args) {
FountainPen p=new FountainPen();
p.refill();
Human ram=new Human();
ram.sleep();
ram.speak();
Monkey m=new Human();
m.bite();
}
}