Why Java does not support multiple inheritance?

please tell me the reasons why java does not support multiple inheritance?

Replies

  • Anoop Kumar
    Anoop Kumar
    Try answering this and you will find understand yourself -
    If an child will have two father.
    Father1 with color white and father2 with color black.
    What will be the color of child?
  • Ankita Katdare
    Ankita Katdare
    Kalpanagosavi
    please tell me the reasons why java does not support multiple inheritance?
    Because JAVA is a "simple", "object oriented", "distributed", "secure", "multi-threaded", "high performance", "dynamic" language.
  • WARDHAMAN BEDMUTHA
    WARDHAMAN BEDMUTHA
    Lets consider a Class Test -

    Class Test {

    public int add ()
    {
    return 1 ;
    }
    }


    Now Class Test1 and Class Test2 extends class Test


    Class Test1 extends Test

    {
    public int add() --Method add is overridden here
    {
    return 2;
    }

    }


    Class Test2 extends Test {


    public int add() --Method add is overridden here
    {
    return 3;
    }

    }

    Now consider a Class Test3 extends Test1, Test2

    Now which version of method add will be implemented in Class Test3 ?
    Will it be with return 3 or with return 2?

    This will lead to confusion,right ?

    So Java does not support multiple inheritance, means creators of Java does not support multiple inheritance.
  • Kalpanagosavi
    Kalpanagosavi
    Thank u!!!
  • msec123
    msec123
    Java absolutely support multiple inheritence in terms of Interface.We can extend one class only to avoid ambiguity problem.In interface we have to define the functions.So we don't get any ambiguity.In c++ it is big problem with multiple inheritence but in JAVA this thing is improved by introducing Interfaces
  • chanks
    chanks
    tell me difference between Machine code and Native code

You are reading an archived discussion.

Related Posts

Hello everyone, I want to learn Hadoop Technology. Can any one Suggest the best portal for this. Thanks in advance
Currently I am in 4th year. I have to make project based on android application. Can anyone suggest me for a new unique android application? Thank you
Hey guys! I will be going in my final year engineering in EXTC stream(Elec and Telecomm). For the final year, my group is supposed to do a project. I'm thinking...
Even though I am a Final year IT student, I am not good in programming. So, I thought that I could learn about web technologies and do my final year...
I am totally new for new for game creation. I am studying Final year Information Technology and I would like to complete my Under Graduation's Final project by creating a...