-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoly_Intro.java
More file actions
50 lines (39 loc) · 1.11 KB
/
Poly_Intro.java
File metadata and controls
50 lines (39 loc) · 1.11 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
interface wifi {
void connecte();
void disconnect();
}
interface recorder {
default void record() {
System.out.println("The the recorder is recording in 4k");
}
void stopRecording();
}
class Phone {
void call() {
System.out.println("The call is connected");
}
}
class SmartPhone extends Phone implements wifi {
public void connecte() {
System.out.println("The wifi is connected to the XYZ network");
}
public void disconnect() {
System.out.println("The network is disconnected");
}
public void record() {
System.out.println("The the recorder is recording vedio in 4k and sound in mp4");
}
public void stopRecording() {
System.out.println("The recorder has stopped recording");
}
}
public class Poly_Intro {
public static void main(String[] args) {
// The object can only use the methodes in the interface wifi(referece)
wifi obj = new SmartPhone(); // Using dynamic methode dispatch
obj.connecte();
SmartPhone ob = new SmartPhone();
ob.call();
ob.connecte();
}
}