Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8364257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:23:25+00:00 2026-06-09T12:23:25+00:00

In an interview it was asked to me to justify when to choose interface

  • 0

In an interview it was asked to me to justify when to choose interface and when to choose abstract classes and in which conditions you will choose out of the two only one.. I have come up with my analysis for interface and that is…

Interface is best choice for Type declaration or defining contract
between multiple parties.
If multiple programmers are working in different modules of a project they still use each others API by defining interface and not waiting
for actual implementation to be ready.

This brings us a lot of flexibility and speed in terms of coding and
development. Use of Interface also ensures best practices like
“programming for interfaces than implementation” and results in more
flexible and maintainable code.

But I don’t have strong reasons to justify the abstract classes, Please advise..!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:23:26+00:00Added an answer on June 9, 2026 at 12:23 pm

    Abstract classes are used to group a number of concrete classes under one entity.

    For example, take the abstract class Animal.
    Animal is not something concrete. it’s a family of, well, animals. but they all share certain aspectes, for example, each has a speak() option (well, except fish and sort). but each one implements it differently. this way you can override just the methods which are not the same, for example sleep() or breath() are common (again, fish are differnet 🙂 ).

    Interfaces on the other hand are more direct definition of an ‘action’. That’s why most (if not all) the interfaces in Java ends with ‘able’ (Comprable, Serializable…)
    By implementing the interface, you’re telling other programmers or who ever uses your code that this class can do this and this.
    A dog, for example, is not, Animable.

    Basically, to sum it up, I think that the best definition is this.
    Use abstract classes when you have a class that A is kind of B and interface when A can do B.

    Hope that’s help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question was asked at interview. Say I have a contract. [ServiceContract] public interface
This question was asked at interview.I need to have running total ( only using
In an Interview,Interviewer asked to me.. that I have a code which written in
This question was asked in interview and deals with recursion/backtracking. Suppose we have two
This was the question asked in interview. Can we call one constructor from another
Recently I have been asked an interview question What are the events order in
I was asked in an interview to enlighten the ways one can use to
This was one of the interview questions asked. How to find the length of
I was recently in an interview where they asked me technical questions. One was
Interview Question I have been asked this question in an interview, and the answer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.