This question is more towards software design.
When should we use a java interface when designing a software system
- is it when we need to support multiple implementations of some functionality or,
- is it because the implementation of a functionality is unknown and it could vary in different contexts.
Please some one help!
I would say both, yes. You should use interfaces a lot. Look at my example from three weeks ago, and the link to an older post there. Examples how engine and plant interfaces can be created, and how the plant interface could be reused and altered three years later.