Last active
August 8, 2016 10:39
-
-
Save ronocod/dcb233e8202db5df70b6e7fc4ab45e9d to your computer and use it in GitHub Desktop.
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
| interface StringGetter { | |
| String getString(); | |
| } | |
| class A { | |
| public A() { | |
| System.out.println("Printing " + getStringer().getString()); | |
| } | |
| public StringGetter getStringer() { | |
| return stringerOne; | |
| } | |
| final StringGetter stringerOne = new StringGetter() { | |
| @Override public String getString() { | |
| return "One"; | |
| } | |
| }; | |
| } | |
| class B extends A { | |
| public B() { | |
| super(); | |
| } | |
| @Override public StringGetter getStringer() { | |
| return stringerTwo; | |
| } | |
| final StringGetter stringerTwo = new StringGetter() { | |
| @Override public String getString() { | |
| return "Two"; | |
| } | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment