-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathch11_defaultMethod.java
More file actions
57 lines (41 loc) · 1.18 KB
/
Copy pathch11_defaultMethod.java
File metadata and controls
57 lines (41 loc) · 1.18 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
interface mycamera{
void takesnap();
void recordvideo();
}
interface mywifi{
String[] getnetworks();
void connectToNetwork(String network);
}
class mycellphone{
void callnumber(int phonenumber){
System.out.println("calling"+phonenumber);
}
void pickcall(){
System.out.println("connecting...");
}
}
class mysmartphone extends mycellphone implements mycamera,mywifi{
public void takesnap(){
System.out.println("taking snap");
}
public void recordvideo(){
System.out.println("taking snap video");
}
public String[] getnetworks(){
System.out.println("getting list og networks");
String [] networklist = {"harry", "shubham", "kohali"};
return networklist;
}
public void connectToNetwork(String network){
System.out.println("connecting to network");
}
}
class ch11_defaultMethod {
public static void main(String[] args) {
mysmartphone ms = new mysmartphone();
String [] ar = ms.getnetworks();
for(String item : ar){
System.out.println(item);
}
}
}