I have an enum that might look like the one below. My goal is to have an enum
with some common methods (I enforced this by adding an abstract method) and some \
Because SPECIAL_VALUE
is an instance of enum
and enum
has only method syso()
.you are calling
Here is the same thing with classes:
interface Foo {
Foo inst1 = new Foo() {
@Override
public void doFoo() {
}
public void doAnonymous() {
}
};
void doFoo();
}
You cannot call method doAnonymous() like Foo.inst1.doAnonymous() and you are able to access the doAnonymous only via reflection