Is there any way to NOT implement all of the methods of an interface in an inheriting class?
We can override all the interface methods in abstract parent class and in child class override those methods only which is required by that particular child class.
Interface
public interface MyInterface{
void method1();
void method2();
void method3();
}
Abstract Parent class
public abstract class Parent implements MyInterface{
@Override
public void method1(){
}
@Override
public void method2(){
}
@Override
public void method3(){
}
}
In your Child classes
public class Child1 extends Parent{
@Override
public void method1(){
}
}
public class Child2 extends Parent{
@Override
public void method2(){
}
}