Model as an Interface or abstract class ?
Model as an interface instead of an abstract class
1. Multiple Inheritance of Type
public interface Vehicle {
void drive();
}
public interface Flyable {
void fly();
}
public class FlyingCar implements Vehicle, Flyable {
@Override
public void drive() {
// implementation
}
@Override
public void fly() {
// implementation
}
}2. Defining Capabilities Without Implementation
3. Contract for Service Providers
Model as an abstract instead of an interface class
1. Providing Common Behavior
2. Sharing State
3. Providing Partial Implementation
Last updated