forked from mohammedabdulbari/Java-SE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InterfaceExample.java
43 lines (33 loc) · 953 Bytes
/
InterfaceExample.java
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
package interfaceexample;
class Phone
{
public void call() { System.out.println("Phone call"); }
public void sms() { System.out.println("Phone sending SMS"); }
}
interface ICamera
{
void click();
void record();
}
interface IMusicPlayer
{
void play();
void stop();
}
class SmartPhone extends Phone implements ICamera,IMusicPlayer
{
public void videoCall() { System.out.println("Smart Phone video calling"); }
public void click() { System.out.println("Smart Phone Clicking Photo"); }
public void record() { System.out.println("Smart Phone recording video"); }
public void play() { System.out.println("Smart Phone playing music"); }
public void stop() { System.out.println("Smart Phone stopped playing music"); }
}
public class InterfaceExample
{
public static void main(String[] args)
{
IMusicPlayer sp=new SmartPhone();
sp.play();
sp.stop();
}
}