In java there is interface which having only abstract method means method declration only and those methods are implement in class that implement interface so why to use interface which has only declaration .This question is asked in interview.
Asked
Active
Viewed 83 times
1 Answers
0
Interfaces are used for only declaration of methods because it can achieve multiple behavior. It is the class's responsibility to implement the interfaces and define their methods as they desire.
Interfaces allow same methods to be implemented in different manner by implementing classes, which allows you to achieve behavioral facility.
For understanding sake, you can consider interfaces exist so you can achieve behavioral approach for your application, and class exist to achieve characteristic approach.

Hemang
- 390
- 3
- 20