Java Interface and Abstract Class? - Programmers Heaven

Howdy, Stranger!

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


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.

Java Interface and Abstract Class?

AngeloQAngeloQ Posts: 1Member
I am a student in Java, and I am trying to understand the concepts of an Interface and an Abstract Class.

Everywhere I try to read about them, even my textbook, I can't quite understand WHEN you would use them. I have seen a few examples of an Interface - isn't it just a class that includes the shells of methods with no actual commands in them? If that is the case, doesn't that would mean you would never actually NEED to use an Interface?

I also understand an Interface cannot be instantiated, it must be implemented - but what does implementing an interface do?


  • krishbalodakrishbaloda Posts: 45Member
    we use interface when something in design will change frequently i.e we can change them in every implementation according our needs.

    Abstract class can have default behavior.i.e code in methods.

    using interface has another advantage i.e. u can implement as many interfaces as u wish but u can't do the same with class(u can extend only one class).

    Interface have all methods as public. u might not wish to expose all the stuff to others thats why Abstract classes are used.
Sign In or Register to comment.