- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterfaceExample.java
More file actions
Latest commit
39 lines (32 loc) · 920 Bytes
/
Copy pathInterfaceExample.java
File metadata and controls
39 lines (32 loc) · 920 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
classPhone
{
publicvoidcall() { System.out.println("Phone call"); }
publicvoidsms() { System.out.println("Phone sending SMS"); }
}
interfaceICamera
{
voidclick();
voidrecord();
}
interfaceIMusicPlayer
{
voidplay();
voidstop();
}
classSmartPhoneextendsPhoneimplementsICamera,IMusicPlayer
{
publicvoidvideoCall() { System.out.println("Smart Phone video calling"); }
publicvoidclick() { System.out.println("Smart Phone Clicking Photo"); }
publicvoidrecord() { System.out.println("Smart Phone recording video"); }
publicvoidplay() { System.out.println("Smart Phone playing music"); }
publicvoidstop() { System.out.println("Smart Phone stopped playing music"); }
}
publicclassInterfaceExample
{
publicstaticvoidmain(String[] args)
{
IMusicPlayersp=newSmartPhone();
sp.play();
sp.stop();
}
}