Created
October 12, 2016 22:14
-
-
Save skiabox/4cc16dc39bc294f102e7da0f4861d3aa to your computer and use it in GitHub Desktop.
Wolf class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.skiabox.java_apps2; | |
/** | |
* Created by administrator on 10/10/2016. | |
*/ | |
public class Wolf extends Canine{ | |
@Override | |
public void makeNoise() { | |
System.out.println("The wolf howls"); | |
} | |
@Override | |
public void eat() { | |
System.out.println("The wolf is eating " + Food.MEAT); | |
} | |
//We can override a method from a superclass and at the same time call it like this | |
public void roam() | |
{ | |
super.roam(); | |
System.out.println(", and now that it is a wolf it is very dangerous for its prey"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment