Last active
September 8, 2017 06:10
-
-
Save travisdowns/92e85659cc9680df82fb0b9a98e11193 to your computer and use it in GitHub Desktop.
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
// file Base.java | |
public class Base { | |
final void print() { System.out.println("base"); }; | |
} | |
// file Derived.java | |
public class Derived extends Base { | |
@Override | |
void print() { | |
System.out.println("derived"); | |
} | |
public static void main(String[] args) { | |
Print.printBase(new Derived()); | |
} | |
} | |
// file Print.java | |
public class Print { | |
static void printBase(Base b) { | |
b.print(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment