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

  • SEARCH
  • Home
  • 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 8077931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:37:52+00:00 2026-06-05T15:37:52+00:00

I was studying about polymorphism. I couldn’t determine the analogy in Java about these

  • 0

I was studying about polymorphism. I couldn’t determine the analogy in Java about these two features.

Let’s say Animal class is a concrete superclass with Cat and Dog as its subclasses. I know that this is a case of inheritance. But isn’t Cat and Dog classes, polymorphs of Animal class?

I am well aware of interfaces in Java. I couldn’t understand why interfaces are used instead of concrete classes to explain polymorphism. It could be that the whole purpose of creating interface is to create polymorphs but I want to know why interfaces and not concrete classes?

  • 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-05T15:37:53+00:00Added an answer on June 5, 2026 at 3:37 pm

    Inheritance

    class Animal{
      public void speak(){ System.out.println("Speaking something");}
    }
    
    class Person extends Animal{
     @Override
     public void speak(){ System.out.println("Hello..");}
    }  
    

    Polymorphism

    Animal a  = new Person();
    a.speak();// Hello
    

    The dictionary definition of polymorphism refers to a principle in
    biology in which an organism or species can have many different forms
    or stages. This principle can also be applied to object-oriented
    programming and languages like the Java language. Subclasses of a
    class can define their own unique behaviors and yet share some of the
    same functionality of the parent class [..]


    Why Interface ?

    You know what needs to be done, but you want implementers to decide how to do it, You will let implementer implement the stuffs forcefully

    • when-best-to-use-an-interface-in-java
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm studying for SCJP, and my book (Sierra's) says about the Formatter class that
I've been studying Java EE 6 and I am confused about the difference between
these days I have been studying about NP problems, computational complexity and theory. I
i started studying java about 2 or 3 months ago and i am fairly
While studying about JMX, I have seen one of the important feature of it
I have recently started studying about threads. I thought of starting from the beginning
I'm studying The C++ Programming Language from Bjarne Stroustrup and he talks about logical
I am studying the CodeCampServer. I am confused about the ASP.NET MvcContrib.CommandProcessor.RulesEngine. Are there
I'm studying for the Zend PHP certification . I am not sure about the
I have been studying DDD in-depth on my own time; reading everything about it

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.