I have an java interface which has few abstract methods.
public interface Interface {
void test();
void test1();
}
Now I have a class A that implements Interface. Requirement is I want to extend class A to multiple client classes. Class A should implement test(). Now I want class A should keep test1 abstract and the implementation of test1 should be done in clients of class A. Is it possible to achieve this in Java. If yes, can somebody correct way to implement this requirement ?
First of all, every method is an interface is public and abstract by default. You have no choice.
Here’s how I’d write it, with better names:
Class
Ccan overridetest1()if it chooses to, but if nothing is done it’ll inherit the behavior specified in classB.