What do you call a snake that tells jokes? Monty Python.

/** * A Snake "is-a" domestic animal! * This means that it has all of the state and behavior of a DomesticAnimal and an Animal, * plus a little bit more! * * extends tells Snake that it is a DomesticAnimal */ public class Snake extends DomesticAnimal{ /** * What additional state might a Snake have? * Because Snake extends DomesticAnimal, which extends Animal, it already has: * name, color, hungerLevel, favoriteFood, owner, and address. * * A Snake has a HISS, which a WildAnimal and an Animal don't * necessarily have! * This is why this trait ("state") is defined in Snake. */ /** * final means that this trait ("state") is a constant. It can't be changed * for any Snake, and all Snakes have the same value for HISS. */ private final String HISS = "Hissssss..."; /** * This is the constructor for a Snake. First, we send the necessary information to * its super constructor in DomesticAnimal. Then, that constructor calls its super constructor in * Animal. We then return to this constructor and set the remaining state unique to Snakes. * All of these constructor calls result in a new Snake with complete state! */ public Snake(String color, String name, String favoriteFood, String owner, String address){ super(color, name, favoriteFood, owner, address); } /** * A Snake already has all of the behavior defined in DomesticAnimal and Animal. * Below is the additional behavior that a Snake would have, but * wouldn't make sense for EVERY animal to have! */ public void makeHiss(){ System.out.println(getName() + " says " + HISS); } public String getHiss(){ return HISS; } /** * What if we want to change how a Snake moves? * DomesticAnimal provides a "default" definition for move() that all * DomesticAnimals can use, but if we want a Tiger to move differently, we can use * override * Overriding a method is when you take the same method "signature" (the first line * of a method), copy it into a child class (Snake is-a child of DomesticAnimal, which * is-a child of Animal), and implement it to do something different. * This gives the Snake the ability to move differently without taking away the * default in DomesticAnimal! */ @Override public void move(){ System.out.println(getName() + " is slithering!"); } //Creating an "instance" (an actual, manipulative "object" to interact with code) of Snake public static void main(String[] args) { Snake sammy = new Snake("Brown", "Sammy", "Bugs", "Billy", "456 Snake Rd"); } }