Skip to content

Commit f7fd2c7

Browse files
Add files via upload
1 parent a493592 commit f7fd2c7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Practicals/poly.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
class shape {
2+
void getShape() {
3+
System.out.println("This is a shape");
4+
}
5+
void hi()
6+
{
7+
System.out.println("hi");
8+
}
9+
}
10+
class circle extends shape{
11+
void getShape() {
12+
System.out.println("This is circle");
13+
}
14+
}
15+
class rectangle extends shape {
16+
void getShape() {
17+
System.out.println("This is rectangle");
18+
}
19+
}
20+
class triangle extends shape {
21+
void getShape() {
22+
System.out.println("This is triangle");
23+
}
24+
}
25+
public class poly {
26+
public static void main(String[] args) {
27+
shape s=new shape();
28+
shape c=new circle();
29+
shape r=new rectangle();
30+
shape t=new triangle();
31+
s.getShape();
32+
c.getShape();
33+
r.getShape();
34+
t.getShape();
35+
}
36+
}

0 commit comments

Comments
 (0)