-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathLion.java
More file actions
38 lines (28 loc) · 738 Bytes
/
Lion.java
File metadata and controls
38 lines (28 loc) · 738 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
package jackpoly;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
class Lion extends Animal {
@JsonProperty
private Boolean king = false;
@JsonCreator
public Lion(@JsonProperty("name") String name) {
this.name = name;
}
public String getName() {
return name;
}
public String getSound() {
return "Roar";
}
public String getType() {
return "carnivorous";
}
public boolean isEndangered() {
return true;
}
@Override
public String toString() {
return "Lion [name=" + name + ", getName()=" + getName() + ", getSound()=" + getSound() + ", getType()=" + getType() + ", isEndangered()="
+ isEndangered() + "]";
}
}