-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultilevelInheritance.java
More file actions
42 lines (35 loc) · 1001 Bytes
/
Copy pathMultilevelInheritance.java
File metadata and controls
42 lines (35 loc) · 1001 Bytes
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
class MobilePhone {
void parent() {
System.out.println("\nEmergency Calls Only! Please check your network.");
}
}
class BasicPhone extends MobilePhone {
void makeCall() {
System.out.println("Calling...");
}
void pickCall() {
System.out.println("Picking up the call...");
}
}
class Smartphone extends BasicPhone {
void takePhoto() {
System.out.println("Taking photo in Soham's IQOO Z9 on 50 MP");
}
void recordVideo() {
System.out.println("Recording video in Soham's IQOO Z9");
}
void playGame() {
System.out.println("Welcome to CLAS OF CLANS");
}
}
public class MultilevelInheritance {
public static void main(String[] args) {
Smartphone myPhone = new Smartphone();
myPhone.parent();
myPhone.makeCall();
myPhone.pickCall();
myPhone.recordVideo();
myPhone.takePhoto();
myPhone.playGame();
}
}