-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_57.java
More file actions
56 lines (56 loc) · 1.35 KB
/
Main_57.java
File metadata and controls
56 lines (56 loc) · 1.35 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 takePhoto();
void recordVideo();
private void quality(){
System.out.println("set quality");
}
default void takePortrait(){
quality();
System.out.println("click portrait");
}
}
interface Wifi{
String[] getNetwork();
void connect(String network);
default void error(){
System.out.println("no connection");
}
}
class Cellphone{
void call(int number){
System.out.println("calling"+number);
}
void pick(){
System.out.println("connecting");
}
}
class Smartphone extends Cellphone implements Wifi, Camera{
public void takePhoto() {
System.out.println("take picture");
}
public void recordVideo(){
System.out.println("record video");
}
public String[] getNetwork(){
System.out.println("setting network");
String[] list={"airtel", "bsnl"};
return list;
}
public void connect(String network) {
System.out.println("connect to"+network);
}
public void error() {
System.out.println("no internet");
}
}
public class Main_57 {
public static void main(String[] args) {
Smartphone s=new Smartphone();
String[] ar=s.getNetwork();
for(String item:ar){
System.out.println(item);
}
s.takePortrait();
s.error();
}
}