-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathInterfaceRules.java
More file actions
80 lines (61 loc) · 1.18 KB
/
InterfaceRules.java
File metadata and controls
80 lines (61 loc) · 1.18 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
interface X{
void print();
public static final int A = 10;
}
interface Y
{
int A = 20;
void print(int x, int y);
Object show();
}
// Multiple Inheritance
// In Java Multiple Inheritance is Allowed only in case of interface
// No Ambiguity Problem , Methods are Empty (Abstract)
// Interface do not have constructor
interface T extends X,Y{
void disp();
}
class T1 implements T{
@Override
public void print(int x, int y) {
// TODO Auto-generated method stub
}
@Override
public void print() {
// TODO Auto-generated method stub
}
@Override
public Object show() {
// TODO Auto-generated method stub
return null;
}
@Override
public void disp() {
// TODO Auto-generated method stub
}
}
class M{
}
//Wrong Way
//class Z implements X,Y extends M{
//}
class Z extends M implements X,Y{
@Override
public String show() {
return "Abcd";
// TODO Auto-generated method stub
}
@Override
public void print() {
// TODO Auto-generated method stub
}
@Override
public void print(int x, int y) {
// TODO Auto-generated method stub
}
}
public class InterfaceRules {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}