-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHybridinhe.java
More file actions
57 lines (49 loc) · 935 Bytes
/
Hybridinhe.java
File metadata and controls
57 lines (49 loc) · 935 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
43
44
45
46
47
48
49
50
51
52
public class Hybridinhe {
public static void main(String[] args) {
Tuna tuna = new Tuna();
tuna.fins = 6;
System.out.println(tuna.fins);
}
}
class Animal {
String color;
void eat() {
System.out.println("eats");
}
void breathe() {
System.out.println("breathes");
}
}
class Fish extends Animal {
void swim(){
System.out.println("Swims in water");
}
}
class Bird extends Animal{
void fly(){
System.out.println("Flying in the sky");
}
}
class Mammals extends Animal {
void walk(){
System.err.println("Walk in earth");
}
}
class Tuna extends Fish {
int fins;
}
class Shark extends Fish {
String skincolor;
}
class Peacock extends Bird {
String gender;
}
class Dog extends Mammals {
String size;
}
class Human extends Mammals {
String color;
}
class Cow extends Mammals {
int legs;
}