-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPolymorphism_interface.java
More file actions
59 lines (50 loc) · 1.18 KB
/
Polymorphism_interface.java
File metadata and controls
59 lines (50 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
58
59
package com.company;
import com.sun.org.apache.xerces.internal.util.XMLEntityDescriptionImpl;
interface Camera
{
void TakeShot();
void record4k();
}
interface GPS {
void turningOn();
}
interface MediaPlayer{
void PlayMusic();
}
class MyCellPhone1 {
public void playGame()
{
System.out.println("Play game ....");
}
}
class SmartPhone extends MyCellPhone1 implements Camera,GPS,MediaPlayer
{
@Override
public void TakeShot() {
System.out.println("Click a photo");
}
@Override
public void record4k() {
System.out.println("Recording 4k videos");
}
@Override
public void turningOn() {
System.out.println("GPS turning on this mobile");
}
@Override
public void PlayMusic() {
System.out.println("Play music on the phone");
}
}
public class Polymorphism_interface {
public static void main(String[] args) {
GPS g1=new SmartPhone();
g1.turningOn();
SmartPhone s1=new SmartPhone();
s1.PlayMusic();
s1.record4k();
s1.TakeShot();
s1.turningOn();
s1.playGame();
}
}