Skip to content

Commit 6071400

Browse files
Add files via upload
1 parent ac8f7b2 commit 6071400

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

JavaGenMUB1.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)