Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Lion extends Animal {
- private boolean isKingOfTheJungle;
- public boolean isKingOfTheJungle() {
- return isKingOfTheJungle;
- }
- public void setKingOfTheJungle(boolean isKingOfTheJungle) {
- if(getGender() != null &&
- getGender().equals("male"))
- this.isKingOfTheJungle = isKingOfTheJungle;
- }
- public Lion(int cell) {
- super(Lion.class.getSimpleName(), cell);
- }
- @Override
- public void move(String from, String to) {
- System.out.println("Walked from " + from
- + " to " + to);
- if(getGender() != null &&
- getGender().equals("male")) {
- System.out.println("And slept for 20 hours");
- }
- }
- @Override
- public void eat() {
- System.out.println("Eats tasty meat!"
- + " (or vegans if there"
- + " are any around :D )");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement