-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHackerrankJava0054.java
36 lines (29 loc) · 1.07 KB
/
HackerrankJava0054.java
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
public class HackerrankJava0054 {
public static void main(String[] args) {
// Java Inheritance I
// https://www.hackerrank.com/challenges/java-inheritance-1/problem?isFullScreen=true
Bird bird = new Bird();
bird.walk();
bird.fly();
bird.sing();
}
}
class Animal {
void walk() {
System.out.println("I am walking");
}
}
class Bird extends Animal {
void fly() {
System.out.println("I am flying");
}
// -------------------------------------------------------------------------------------------------
// --- You need to add this lines for solution hackerrank provides all other lines for challange ---
// -------------------------------------------------------------------------------------------------
void sing() {
System.out.println("I am singing");
}
// -------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------
}