-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCH_11_Polymorphism.java
More file actions
54 lines (47 loc) · 1.11 KB
/
Copy pathCH_11_Polymorphism.java
File metadata and controls
54 lines (47 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
51
52
53
54
interface MyCamera2{
void snap();
void takeVideo();
private void Greet(){
System.out.println("Welcome");
}
default void Take4kVideo(){
Greet();
System.out.println("Taking 4K Video");
}
}
interface wifi2{
String [] takeNetwork();
}
class MycelPhone2{
void call(){
System.out.println("calling");
}
}
class MySmartPhone2 extends MycelPhone2 implements MyCamera2,wifi2 {
public void snap() {
System.out.println("Taking Snap");
}
public void takeVideo() {
System.out.println("taking Video");
}
public String[] takeNetwork() {
System.out.println("Checking wifi");
String[] Network = {"TpLink", "Atharva", "wifi001", "TpLink00"};
return Network;
}
public void Take4kVideo() {
System.out.println("4K");
}
}
public class CH_11_Polymorphism {
public static void main(String[] args) {
MyCamera2 cam =new MySmartPhone2();
cam.snap();
cam.Take4kVideo();
wifi2 wi=new MySmartPhone2();
String [] bd=wi.takeNetwork();
for (String gg:bd){
System.out.println(gg);
}
}
}