Skip to content

Instantly share code, notes, and snippets.

@digvijaybhakuni
Created August 5, 2014 19:28
Show Gist options
  • Save digvijaybhakuni/16b32165cd7bdc3e442b to your computer and use it in GitHub Desktop.
Save digvijaybhakuni/16b32165cd7bdc3e442b to your computer and use it in GitHub Desktop.
Example of Overrinding
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