
- Forum
- Programming Talk
- Java
- Unique use of Interface
Unique use of Interface
This is a discussion on Unique use of Interface within the Java forums, part of the Programming Talk category; We have been using interface in many ways. But i still struggle to find out the unique reason of interface. ...
-
07-06-2010, 05:09 AM #1
- Join Date
- Jul 2010
- Answers
- 1
Unique use of Interface
We have been using interface in many ways. But i still struggle to find out the unique reason of interface. ie. The thing which cannot be done in Java without Interface. One certain example is Multiple Interface cannot be achieved w/o interface. I need some more reasons. If anyone knows please share it.
-
i. Interface in java is used for implemntion the concept of polymerphism i.e a behaviour can behave differently depading upon the requirment. and situation where it is used.
i.e suppose i declared a interface called as calculateArea and in that i am declering a methood named as area. whennever i ll implement that interface as the rule of interface says that i have to provide the implementation for the area methood.
so if i implement that interface in Circle class then i ll provide the implementation for the area methood of interface as to calculate the area of the circle.
-
Hi
Multiple Inheritance is not directly supported by Java but it can be achieved through Interface and so the unique use of Interface is to support multiple inheritance in Java.
-
The unique usage of the interface is just to support the multiple inheritance in the java, since java wont support multiple inheritance.
-
12-28-2010, 06:25 AM #5
- Join Date
- Dec 2010
- Location
- New Delhi, India, India
- Answers
- 3
Hi, it is rally true but there is one thing which the Interface is mainly boarn is Interface data member is constant.
-
Sponsored Ads

Reply With Quote





