Skip to content

Commit 2dd815b

Browse files
authored
Add files via upload
1 parent 61d3432 commit 2dd815b

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Interface.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
interface Shape{
2+
int a=4;
3+
double PI=3.14;
4+
void area();
5+
}
6+
class Circle implements Shape{
7+
public void area(){
8+
System.out.println("The area of circle is "+(PI*a*a));
9+
}
10+
}
11+
class Square implements Shape{
12+
public void area(){
13+
System.out.println("The area of square is "+(a*a));
14+
}
15+
}
16+
17+
public class Interface {
18+
public static void main(String args[]){
19+
Circle c = new Circle();
20+
Square s = new Square();
21+
c.area();
22+
s.area();
23+
}
24+
}

0 commit comments

Comments
 (0)