- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHackerrankJava0047.java
More file actions
Latest commit
32 lines (23 loc) · 683 Bytes
/
Copy pathHackerrankJava0047.java
File metadata and controls
32 lines (23 loc) · 683 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
publicclassHackerrankJava0047 {
publicstaticvoidmain(String[] args) {
// Java Method Overriding 2 (Super Keyword)
// https://www.hackerrank.com/challenges/java-method-overriding-2-super-keyword/problem?isFullScreen=true
MotorCycleM = newMotorCycle();
}
}
classBiCycle {
Stringdefine_me() {
return"a vehicle with pedals.";
}
}
classMotorCycleextendsBiCycle {
Stringdefine_me() {
return"a cycle with an engine.";
}
MotorCycle() {
System.out.println("Hello I am a motorcycle, I am " + define_me());
// --- You need to update this line ---
Stringtemp = super.define_me();
System.out.println("My ancestor is a cycle who is " + temp);
}
}