CrazyEngineers
  • Why Java does not support multiple inheritance?

    Updated: Oct 27, 2024
    Views: 1.1K
    please tell me the reasons why java does not support multiple inheritance?
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Anoop Kumar

    MemberJul 4, 2015

    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?
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorJul 6, 2015

    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.
    Are you sure? This action cannot be undone.
    Cancel
  • WARDHAMAN BEDMUTHA

    MemberJul 6, 2015

    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.
    Are you sure? This action cannot be undone.
    Cancel
  • Kalpanagosavi

    MemberJul 10, 2015

    Thank u!!!
    Are you sure? This action cannot be undone.
    Cancel
  • msec123

    MemberJul 12, 2015

    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
    Are you sure? This action cannot be undone.
    Cancel
  • chanks

    MemberJul 18, 2015

    tell me difference between Machine code and Native code
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register