Why do birds fly south for the winter? It’s too far to walk.
/**
     * This is a constructor -- it simply creates a new Animal (an "instance") that
     * you can do things with.
     * 
     * this means "of the Animal you're doing something with."
     * In this case, we use this to set the state of our new
     * Animal to the parameters provided when we made the new
     * Animal.
     */
    public Animal(String color, String name, String favoriteFood){
        this.color = color;
        this.name = name;
        this.favoriteFood = favoriteFood;
        hungerLevel = 10;
    }
    
    
    //These are the methods ("behaviors" of an animal) all Animals should have.
    
    /**
    * All Animals should eat, and let's say that all Animals eat the "same way."
    * This means that we can define how an Animal eats now, because it applies
    * to all Animals.
    */
    public void eat(){
        if(hungerLevel > 0){
            hungerLevel -= 1;
            System.out.println(name + " is eating " + favoriteFood);
        }
        else{
            System.out.println(name + " is full!");
        }
    }
    
    /**
     * We want to be able to get the values of all of the Animal's traits.
     * Because we made our state private, we need to use getters, which 
     * simply return state.
     * Without getters, nothing outside of this file can see private things!
     * This is a getter for color!
     * In reality, we would write getters for name, favoriteFood, and hungerLevel too.
     */
    public String getColor(){
        return color;
    }
    
    
    public String getName(){
        return name;
    }
    
    
    /**
     * abstract means that this behavior will be implemented later.
     * For now, we're just saying that every Animal SHOULD be able to move
     * 
     * void means the method doesn't "return" anything.
     * This means that you will not get a value back from calling this method.
     * You can still use void methods to change the state ("traits") of an animal,
     * like we did in eat()!
     */
    public abstract void move(); 
    
}
                            
                        Level 1
                        Level 2
                        Level 3
                        Level 4
                        Level 5
                        Glossary