top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Java: using interface how re-usability concept achieved?

+2 votes
331 views

The purpose of Inheritance is re-usability, we achieved multiple inheritance by using interface. but by using interface how re-usability concept achieved?

posted Oct 13, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Code reusability sounds as simple as copy and pasting code. However, code written specifically for another project tends to make use of things specific to that project, and it is sometimes easier to rewrite the code from scratch than to make the modifications needed to make it work in a new project.

Using Java Interfaces, Java addresses this problem is through the use of interfaces. Interfaces are an optional feature of Java that allow a developer to define a set of method calls needed to complete a task, and then separately write a class that implements that interface. This ensures that, in the future, the code can be used in any situation that the original interface could be used in. Ideally, developers also need to play along, by writing methods and classes that implement interfaces and that require broader interfaces rather than project-specific classes whenever possible.

Read more : http://www.ehow.com/facts_7617747_java-supports-software-reusability.html

answer Oct 13, 2014 by Pushkar K Mishra
...