Skip to content

Instantly share code, notes, and snippets.

@travisdowns
Last active September 8, 2017 06:10
Show Gist options
  • Save travisdowns/92e85659cc9680df82fb0b9a98e11193 to your computer and use it in GitHub Desktop.
Save travisdowns/92e85659cc9680df82fb0b9a98e11193 to your computer and use it in GitHub Desktop.
// 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