-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqb25.java
More file actions
37 lines (29 loc) · 775 Bytes
/
Copy pathqb25.java
File metadata and controls
37 lines (29 loc) · 775 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
//QB-25
//Multiple Inheritance using Interface
import java.util.Scanner;
interface circle {
void arcircle(int r);
}
interface square {
void arsquare(int l);
}
class shape implements circle, square {
public void arcircle(int r) {
System.out.println("Area of Circle is: " + 3.14 * r * r);
}
public void arsquare(int l) {
System.out.println("Area of Square is: " + l * l);
}
}
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter r for circle: ");
int r = sc.nextInt();
System.out.println("Enter l for square: ");
int l = sc.nextInt();
shape s = new shape();
s.arcircle(r);
s.arsquare(l);
}
}