Created
March 21, 2012 16:40
-
-
Save dherman/2149388 to your computer and use it in GitHub Desktop.
super.methodCall() in Java
This file contains hidden or 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
public class Animal { | |
public void foo() { | |
System.out.println("foo!"); | |
} | |
public void bar() { | |
System.out.println("bar!"); | |
} | |
} |
This file contains hidden or 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
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