Issue
Possible Duplicate:
why we need interface in java?
I refered the following link
can anyone explain any reason why we are using interface in java?
Other than
- multiple inheritance is possible with interfaces.
- polymorphism
Solution
Other than what you have mentioned, interfaces are a good way of exposing a set of functions (API) without divulging any information on their implementation.
By definition, when a class implements
an Interface
, it is agreeing to implementing a series of methods. This will allow any caller to use these methods without:
- The caller having to worry about how is the function implemented;
- Whoever wrote the function to worry about exposing internal logic.
Answered By - npinti Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.