-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBird.java
More file actions
39 lines (29 loc) · 683 Bytes
/
Copy pathBird.java
File metadata and controls
39 lines (29 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
33
34
35
36
37
38
39
package reflection;
@Markable("main-bird")
public class Bird extends Animal implements Flying, Comparable<Bird>{
@Markable("age")
private int age;
public Bird() {
}
private Bird(int age) {
this.age = age;
}
public Bird(String type, int age) {
super(type);
this.age = age;
}
private boolean canEat(String name) {
return true;
}
public void walk() {
System.out.println("The bird is walking");
}
@Override
public void fly() {
System.out.println("The bird is flying quickly");
}
@Override
public int compareTo(Bird o) {
return this.age - o.age;
}
}