Can someone please give any other advantage of using interface apart from multiple inheritance as its functionality can be obtained by abstract classes as well??


  • Interfaces is a powerful concept of Java which helps in achieving multiple inheritance to certain extent.

    Interface is similar to a abstract class expect that all the methods in it are abstract. We can not include the method body for any of the methods in interface i.e. we can not define concrete methods in interface. The other differences between interface and class are explained in Interfaces Vs Abstract Classes.
    The syntax for creating an interface is
    interface interface-name
    return-type method-name-1(parameters);

    return-type method-name-2(parameters);

    For more details and practice programs please follow the link.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion