-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmyinterface.java
More file actions
63 lines (57 loc) · 1.06 KB
/
Copy pathmyinterface.java
File metadata and controls
63 lines (57 loc) · 1.06 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
public class myinterface
{
public static void main(String[] args)
{
mg y=new mg();
y.p();
y.printf();
y.printk();
y.printg();
mg x=new mg();
myi p=(myi)x;
p.callspi();
}
}
class myclass
{
public void print()
{
System.out.println("Hi! This is the method of the superclass.");
}
}
interface myi
{
public void printf();
public void callspi();
}
interface kyi extends myi
{
public void printk();
}
interface pyi
{
public void printg();
}
class mg extends myclass implements myi, pyi
{
public void p()
{
super.print();
}
public void printf()
{
System.out.println("Hi! This is the method of interface \'myi\'.");
}
public void printk()
{
System.out.println("Hi! This is the method of subinterface \'kyi\' of interface \'myi\'.");
}
public void printg()
{
System.out.println("This is the method of interface of \'pyi\'.");
}
public void callspi()
{
System.out.println("This is the method called when a new object is made of class which implements interface \'myi\' & then a variable of type \'myi\'is used to refer to it.");
}
}