With only a small amount of time to search for such things, I could not see anything that covered my specific scenario.
I work with a third-party interface. Let's say for a moment it looks like this:
public interface interface1 { public String getVar1(); public void method1(); public void method2(); }
I need to create several classes that use this interface, but the actual implementation of the method "method2" will be different for each, where "method1" and "getVar1" will always be the same code.
Is there a way to create an abstract base class that implements the interface, but only forces the implementation of "method2" to the child classes?
I tried
public abstract @Override void method2
but while this is “acceptable” during development in Netbeans (I don’t know if Eclipse works differently) at compile time, he complains that method2 must be implemented.
If this is not possible, rightly, I just need to check.
thanks
source share