Free Jobs
Reference


Java Questions: Core Java (182) J2EE (32) EJB (22) Servlet (33) JDBC (35) Hibernate (17) Struts (15) Swing (26) Oracle (12) JSP (36) Other (0)

Question: WHY THERE IS NO MULTIPLE INHERITENSE IN JAVA

To get the Posted Questions details daily in your mail Click Here

Share this question on Facebook/Twitter/Orkut Bookmark and Share





User: neeraj11 Post Date: 15 Aug 2011 14:05

Introduction:
THERE IS NO MULTIPLE INHERITENSE IN JAVA..........BUT WHY??



Answer:
PLEASE ANSWER THIS QUESTION



About Writer:
NEERAJ


Writer's Link:

Writer's Email:







Comments:
  • User: rtmadhusudhanreddy Post Date:   17 Aug 2011 07:35
    if multiple inheritence exists then the object of one class must get the properties from more than one  objects

    if other two objects contains same function with respect to name , parameters and return type

    then the  JVM  cannot understand this function belongs to which object from

    getting the properties then it causes to  serious problem

    this is the reson y  multiple inheritence are not exist in java


  • User: rtmadhusudhanreddy Post Date:   17 Aug 2011 07:35
    if multiple inheritence exists then the object of one class must get the properties from more than one  objects

    if other two objects contains same function with respect to name , parameters and return type

    then the  JVM  cannot understand this function belongs to which object from

    getting the properties then it causes to  serious problem

    this is the reson y  multiple inheritence are not exist in java


  • User: gourav_it Post Date:   18 Aug 2011 03:13
    don''t you think multiple inheritance creates problem and confusion in some situations  ? :)

    java has interface for doing that same task


  • User: mayankgarg3112 Post Date:   18 Aug 2011 13:30
    cz if there is multiple inheritance , a class will be able to extend more than one classes .So suppose class extends two classes and those two classes has the method with the same name .it occurs the problem for the class who extends it to call which class method.



    Mayank Garg


  • User: venkigummadi@gmail.com Post Date:   21 Aug 2011 00:15
    can u compile and run without main method?


  • User: nilesh370 Post Date:   27 Aug 2011 23:42
    Java and C# does not support multiple inheritance to avoid complexity and confusion. Instead for this purpose INTERFACE concept is introduced so that the same class can represent different structure.

  • User: vardhan4vm Post Date:   29 Aug 2011 10:31
    In java,we have don''t have multiple inheritance.inheritence means acquiring properties one class to another class

  • User: aannadhurai@gmail.com Post Date:   31 Aug 2011 01:17
    Java does not support multiple inheritances because it causes more problems than it solves. Instead Java

    supports multiple interface inheritance, which allows an object to inherit many method signatures from

    different interfaces with the condition that the inheriting object must implement those inherited methods. The

    multiple interface inheritance also allows an object to behave polymorphically on those methods


  • User: aannadhurai@gmail.com Post Date:   31 Aug 2011 01:18
    Java does not support multiple inheritances because it causes more problems than it solves. Instead Java

    supports multiple interface inheritance, which allows an object to inherit many method signatures from

    different interfaces with the condition that the inheriting object must implement those inherited methods. The

    multiple interface inheritance also allows an object to behave polymorphically on those methods


  • User: adityajain Post Date:   02 Sep 2011 01:23
    because in JAVA there if we do the multiple inheritance compiler doesn''t know that from which class it access the base class so there is ambiguity. to remove this ambiguity java doesn''t support multiple inheritance.


  • User: anil123 Post Date:   19 Sep 2011 06:56

    Because  The More chance for ambiguity That why java is not support Multiple Inheritance.


  • User: deepaknegi.gud Post Date:   30 Sep 2011 04:43
    there is no multiple inheritance becz



    java is based on real life concepts, one child can not have more than one father.



    but the son is identified by multiple ways.



    1   by his name( class name)

    2   by his parent name ( super class name)

    3   by their Friends name or something else(  by interface name)



    there are two type of inheritance in java

    1- implementation inheritance  (through extends )           2- interface inheritance (through interface)

    if u want details in java  you can post or  read articles          in my facebook page  "CLICK ON JAVA"



    https://www.facebook.com/pages/JUST-Click-on-JAVA/144565665639438

    d
    eepak negi   deepaknegi.gud@gmail.com     9871488642

  • User: navyagowda Post Date:   04 Oct 2011 00:04


    Bcoz it leads to ambiguity



  • User: suryavanshiankit81 Post Date:   09 Oct 2011 00:17
    there is no any subclass can extends more than  one class.there is only one super class for every sub class

    it may be that a super class have more than one subclass.

  • User: niksrules Post Date:   16 Oct 2011 01:09
    very interesting question to deal with. Multiple inheritance situation arises when a class is derived from more than one parent class.



    Here in case if both the parent class have a method with the same name, say "withdarw()" & child class object (say o1) is used to invoke any one method of these parent classes then for sure there will be ambiguity for the JAVA compiler(JVM) that which method to call.



    Being the  Java a "Strictly typed" & "Ambiguity free" language, Multiple inheritance is not allowed in Java.



    Interesting point here to discuss is that though Multiple inheritance is not allowed in Java, it is possible to have all the benefits those we used to get (from Multiple inheritance in C ). The solution is Abstract Classes & Interfaces.









    Regards,



    Nikhil Ghadge

    ( 91-9221919989)


  • User: ankit355 Post Date:   21 Oct 2011 15:20
    this is basically to minimize the RAM usage. In java, we have to strictly follow the principle of inheritance and for that each and every subclass has to call the constructor of its superclass upto the highest level of hierarchy i.e. OBJECT class. If multiple inheritance is allowed than each subclass will have to call the constructor of all of its superclasses which in turn would call the constructors of their superclasses...hence wasting the RAM. Therefore, in java we maintain a linear relationship up the hierarchy till OBJECT class in order to avoid unnecessary calling of so many constructors.

  • User: m.kalyani92@gmail.com Post Date:   27 Oct 2011 08:05
    when your we are using multiple inheritance in java means some diamond problem is there.so instant that we will use the multiple interface inheritance.


  • User: kapeel45 Post Date:   08 Nov 2011 05:19
    To avoid ambiguity java does not use multiple inheritance.


  • User: jennifer100 Post Date:   13 Nov 2011 02:54
    Java creators wanted the language to be simple.Java does not support multiple inheritance because,Multiple inheritance causes more problems and complexity to the language than it solves.

    Also java supports multiple interface inheritance to compensate for Multiple inheritance.






Post Comment





Similar Questions Top QuestionsLatest Questions Other Questions by this Author







www.freejobsreference.com Copyright © 2009-2011 | All Rights Reserved
All content of this website is protected by copyright laws and should not be reproduced in any form or by any means without written permission
(Best viewed in IE 8.0+ or Firefox 3.0+ at resolution of 1024 * 768 or higher)