Last active
October 16, 2019 11:11
-
-
Save alex-ber/09981e0d405c037a0a44ba348175cfae to your computer and use it in GitHub Desktop.
Animal
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
class Animal{ | |
public void sound(){ | |
System.out.println("Animal is making a sound"); | |
} | |
} | |
class Horse extends Animal{ | |
@Override | |
public void sound(){ | |
System.out.println("Neigh"); | |
} | |
} | |
public class Driver { | |
public static void main(String args[]){ | |
Animal obj = new Horse(); | |
obj.sound(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment