Skip to content

Instantly share code, notes, and snippets.

@dherman
Created March 21, 2012 16:40
Show Gist options
  • Save dherman/2149388 to your computer and use it in GitHub Desktop.
Save dherman/2149388 to your computer and use it in GitHub Desktop.
super.methodCall() in Java
public class Animal {
public void foo() {
System.out.println("foo!");
}
public void bar() {
System.out.println("bar!");
}
}
public class Horse extends Animal {
public void foo() {
super.bar();
}
public static void main(String[] args) {
new Horse().foo(); // bar!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment