Interfaces in JAVA
What is the use of Interfaces in Java? Multiple Inheritance only!! I don't think so......Can someone explain me what were the many reasons for interfaces coming in existence
Its a contract. Objects declared as an interface guarantee that they will contain the methods contracted by that interface. Since Java does not support multiple extends, interfaces are used to perform multiple inheritance, and because of the lack of multiple extends, interfacing is far more valuable in Java than extends ever will be.
So yes, short version would be that interfaces are used for multiple inheritance as it allows you to interpret a single class as multiple datatypes.
|All times are GMT +1. The time now is 06:35 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.