-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefault_Methods.java
More file actions
56 lines (45 loc) · 1.19 KB
/
Default_Methods.java
File metadata and controls
56 lines (45 loc) · 1.19 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
interface Camera {
void takeSnap();
void recordVideo();
}
interface Wifi {
String[] getNetworks();
void connectNetwork(String connected);
}
class myCellPhone {
void call(int phoneNumber) {
System.out.println("Calling to : " + phoneNumber);
}
void takeCall() {
System.out.println("Taking call...");
}
}
class mySmartPhone extends myCellPhone implements Camera, Wifi {
// ? Method of Camera
public void takeSnap() {
System.out.println("Take Snaps!");
}
public void recordVideo() {
System.out.println("Recording Video!");
}
// ? Method of Wifi
public String[] getNetworks() {
return new String[] { "GPRS", "EDGE", "UMTS" };
}
public void connectNetwork(String connected) {
System.out.println("Connected to " + connected);
}
}
public class Default_Methods {
public static void main(String[] args) {
mySmartPhone ms = new mySmartPhone();
ms.takeSnap();
ms.takeCall();
ms.recordVideo();
ms.getNetworks();
ms.connectNetwork("GPRS");
ms.connectNetwork("EDGE");
ms.connectNetwork("UMTS");
ms.call(123456789);
}
}