- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHackerrankJava0054.java
More file actions
Latest commit
36 lines (29 loc) · 1.07 KB
/
Copy pathHackerrankJava0054.java
File metadata and controls
36 lines (29 loc) · 1.07 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
publicclassHackerrankJava0054 {
publicstaticvoidmain(String[] args) {
// Java Inheritance I
// https://www.hackerrank.com/challenges/java-inheritance-1/problem?isFullScreen=true
Birdbird = newBird();
bird.walk();
bird.fly();
bird.sing();
}
}
classAnimal {
voidwalk() {
System.out.println("I am walking");
}
}
classBirdextendsAnimal {
voidfly() {
System.out.println("I am flying");
}
// -------------------------------------------------------------------------------------------------
// --- You need to add this lines for solution hackerrank provides all other lines for challange ---
// -------------------------------------------------------------------------------------------------
voidsing() {
System.out.println("I am singing");
}
// -------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------
}