We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ac8f7b2 commit 6071400Copy full SHA for 6071400
1 file changed
JavaGenMUB1.java
@@ -0,0 +1,33 @@
1
+//Multiple Upper Bound
2
+
3
4
+interface A {
5
+ public int add(int i, int j);
6
+}
7
8
9
+class B implements A {
10
+ @Override
11
+ public int add(int i, int j){
12
+ return i+j;
13
+ }
14
15
16
17
+public class JavaGenMUB1<T extends B & A > {
18
+ public int mul(int i, int j) {
19
+ return i * j;
20
21
+ public int mul(int i, int j, int k) {
22
+ return i * j * k;
23
24
+ public static void main(String[] args) {
25
+ JavaGenMUB1<B> obj = new JavaGenMUB1<>();
26
+ System.out.println(obj.mul(10, 5));
27
+ System.out.println(obj.mul(10, 5,14));
28
29
30
31
32
33
0 commit comments