-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaGenMUB3.java
More file actions
46 lines (36 loc) · 853 Bytes
/
JavaGenMUB3.java
File metadata and controls
46 lines (36 loc) · 853 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
38
39
40
41
42
43
44
45
46
interface A {
public int add(int i, int j);
}
interface B {
public int sub(int i, int j);
}
interface C{
public int mul(int i, int j);
}
class D implements A, B, C{
@Override
public int add(int i, int j) {
return i + j;
}
@Override
public int sub(int i, int j) {
return i - j;
}
@Override
public int mul(int i, int j) {
return i * j;
}
}
public class JavaGenMUB3 <T extends D & A &B & C> {
public int div(int i, int j) {
return i / j;
}
public int div(int i, int j, int k) {
return i / j / k;
}
public static void main(String[] args) {
JavaGenMUB3<D> obj = new JavaGenMUB3<>();
System.out.println(obj.div(10, 5));
System.out.println(obj.div(10, 5, 2));
}
}