-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShape.java
More file actions
56 lines (55 loc) · 1.38 KB
/
Shape.java
File metadata and controls
56 lines (55 loc) · 1.38 KB
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
public class Shape {
public void draw(){
System.out.println("Draw Shape");
}
public void erase(){
System.out.println("Erase Shape");
}
public static void main(String[] args) {
Shape ss = new Shape();
Shape c = new Circle();
Shape t = new Triangle();
Shape s = new Square();
ss.draw();
ss.erase();
System.out.println("........................................");
c.draw();
c.erase();
System.out.println("........................................");
t.erase();
t.draw();
System.out.println("........................................");
s.draw();
s.erase();
}
}
class Circle extends Shape{
@Override
public void draw(){
System.out.println("Drawing Circle");
}
@Override
public void erase(){
System.out.println("Erasing Circle");
}
}
class Triangle extends Shape{
@Override
public void draw(){
System.out.println("Drawing Traingle");
}
@Override
public void erase(){
System.out.println("Erasing Triangle");
}
}
class Square extends Shape{
@Override
public void draw(){
System.out.println("Drawing Square");
}
@Override
public void erase(){
System.out.println("Erasing Square");
}
}