-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface2.java
More file actions
60 lines (44 loc) · 1.34 KB
/
interface2.java
File metadata and controls
60 lines (44 loc) · 1.34 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
58
59
60
//default method
//static mathod ek object se associated nahi hota vo ek class or interference se associated hota hai
////default methods enable us to add new functionality to existtance interference
interface camera {
void takesnap();
void recordvideo();
}
interface wifi {
String[] getnetwork();
void connecttonetwork(String Network);
}
class cellphone {
void callnumber(int number) {
System.out.println("calling : " + number);
}
void pickcall() {
System.out.println("connecting.....");
}
}
class smartphone extends cellphone implements wifi, camera {
public void takesnap() {
System.out.println("taking snap");
}
public void recordvideo() {
System.out.println("recording ");
}
public String[] getnetwork() {
System.out.println("the network list");
String[] networklist = { "varad", "amu", "ankita" };
return networklist;
}
public void connecttonetwork(String network) {
System.out.println("connecting to" + network);
}
}
public class interface2 {
public static void main(String[] args) {
smartphone ms = new smartphone();
String[] ar = ms.getnetwork();
for (String item : ar) {
System.out.println(item);
}
}
}