interfaces - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

interfaces

ghostrider123ghostrider123 Posts: 5Member
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??

Comments

  • GouthamKumarGouthamKumar NellorePosts: 17Member

    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. http://java.meritcampus.com/t/124/Interfaces---simulate-multiple-inheritance

Sign In or Register to comment.