Created
August 5, 2014 19:28
-
-
Save digvijaybhakuni/16b32165cd7bdc3e442b to your computer and use it in GitHub Desktop.
Example of Overrinding
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 Bird{ | |
public void info(){ | |
System.out.println("Bird Can fly"); | |
} | |
} | |
class Kiwi extends Bird{ | |
public void info(){ | |
System.out.println("Kiwi Can't fly"); | |
} | |
} | |
public class ExOverriding{ | |
public static void main(String args[]){ | |
Bird bird = new Bird(); | |
Bird kiwi = new Kiwi(); | |
bird.info();//Bird Can fly | |
kiwi.info();//Kiwi Can't fly | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment