Skip to content

Instantly share code, notes, and snippets.

@RobertFischer
Created May 6, 2015 14:04
Show Gist options
  • Save RobertFischer/bbf84b9e8986becd8940 to your computer and use it in GitHub Desktop.
Save RobertFischer/bbf84b9e8986becd8940 to your computer and use it in GitHub Desktop.
Demonstration of Anonymous Extension in Java
public class AnonymousExtend {
public static class Doer {
public void doIt() {
System.out.println("Hello, World!");
}
}
public static final Doer MY_DOER = new Doer() {
@Override
public void doIt() {
System.out.println("OVERRIDE!");
}
};
public static void main(String[] argv) {
MY_DOER.doIt();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment