• Dear Guest, Please do NOT forget to join our JAVA JOBS (ONLY) FACEBOOK GROUP to be aware of latest JAVA openings, and you may also post any JAVA related queries/jobs.

In Java which one to use Abstract Class or Interface ?

- Use Abstract Class if you're sure that there can be more specialized subclasses of Abstract Class and there is really a logic is a relationship.

- Dont use Abstract Class just for code reuse.

- Use Interface to encapsulate behaviour and let concrete subclasses to implement that behaviour.

- An alternative approach could be to use Abstract Class to have common implementation and for the behaviour which is gonna very use composition for the varying behavior.
Java doesn't accept assorted inheritance; thus, you cannot accept a chic that accouterments two abstruse classes at once. ... An interface is bigger than a abstruse chic back you demand assorted classes to apparatus that interface and back you don't accept to accede absence behavior.