Interfces in Java
Interfces in Java
- by utk
Think of it as a blueprint:
• It declares methods but does not implement them (until Java 8).
• A class that implements an interface must provide concrete implementations for
all its abstract methods.
Achieve abstraction
Support multiple inheritance (Java doesn't allow multiple class inheritance)
Promote loose coupling and better testability
Enable polymorphism (use different implementations interchangeably)