- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShapetest.java
More file actions
Latest commit
29 lines (29 loc) · 882 Bytes
/
Copy pathShapetest.java
File metadata and controls
29 lines (29 loc) · 882 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
importjava.util.*;
abstractclassshape{
abstractvoidnumberofsides();
}
classtriangleextendsshape{
voidnumberofsides(){
System.out.println("the number of sides of triangle is 3\n");
}
}
classRectangleextendsshape{
voidnumberofsides(){
System.out.println("the number of sides of rectangle is 4\n");
}
}
classhexagonextendsshape{
voidnumberofsides(){
System.out.println("the number of sides of hexagon is 6\n");
}
}
classShapetest{
publicstaticvoidmain(StringArgs[]){
trianglet=newtriangle();
Rectangler=newRectangle();
hexagonh=newhexagon();
t.numberofsides();
r.numberofsides();
h.numberofsides();
}
}