-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMammals.java
More file actions
43 lines (37 loc) · 1.5 KB
/
Mammals.java
File metadata and controls
43 lines (37 loc) · 1.5 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
class Mammals_1 {
String food;
String sound;
String child;
String area;
void info() {
System.out.println("INFORMATION ABOUT MAMMALS");
}
}
class Lion extends Mammals_1 {
void roar(String food, String sound, String area, String child) {
System.out.println("This animal eats :- " + food + " | This animal makes this sound :- " + sound +
" | This animal lives in :- " + area + " | These give birth to :- " + child);
}
}
class Elephant extends Mammals_1 {
void Step(String food, String sound, String area, String child) {
System.out.println("This animal eats :- " + food + " | This animal makes this sound :- " + sound +
" | This animal lives in :- " + area + " | These give birth to :- " + child);
}
}
class Humans extends Mammals_1 {
void Sssss(String food, String sound, String area, String child) {
System.out.println("Us Humans eat :- " + food + " | This animal makes this sound :- " + sound +
" | This animal lives in :- " + area + " | These give birth to :- " + child);
}
}
public class Mammals {
public static void main(String[] args) {
Lion l = new Lion();
Elephant e = new Elephant();
Humans h = new Humans();
l.roar("Meat", "ROAR", "Jungles", "Cubs");
e.Step("Banana", "EEUHH", "Wild Areas", "Calves");
h.Sssss("Veg food", "Speaking Skills", "Urban and Rural Areas", "Human Children");
}
}