Results 1 to 7 of 7

Thread: Java

  1. #1

    Post Java

    Why Multiple Inheritance is not supported by java?


  2. #2
    Junior Member
    Join Date
    Sep 2007
    Answers
    3

    Re: Java

    Hi!

    Because, there are a lots of minutes issues if we use class-based multiple inheritance.
    Although Java support interface-based multiple inheritance...

    Enjoy Development


  3. #3

    Re: Java

    The main objective of OOP is to provide security. But through the multiple inheritance one class data will be available to the other classes that means we r not providing security for the classes.
    Thats why multiple inheritance was not supported by Java. But it indirectly supports through the interfaces. In interfaces we can inherit more than one interfaces.


  4. #4
    Expert Member
    Join Date
    Jun 2007
    Answers
    260

    Re: Java

    hi,

    this is discussed in the forum, please refer to this link also, hope it will be helpful to you OOPS - why is multiple inheritance not allowed in java?

    Thanks
    Sushma


  5. #5
    Junior Member
    Join Date
    Sep 2008
    Answers
    2

    Re: Java

    to avoid ambiguity


  6. #6
    Junior Member
    Join Date
    Oct 2008
    Answers
    1

    Re: Java

    In C++ there was concept of multiple inheritance,but threre was some ambiguity in the method names,if two classes have same method name then it was difficult to know which method is being called ,if class inherriting both of those classes.
    So to reduce compexity and ambiguity java supports only single inheritence,however it can inherit multiple interfaces.


  7. #7
    Contributing Member
    Join Date
    Oct 2008
    Answers
    72

    Re: Java

    Whenever you find yourself asking why Java has or does not have some feature, consider the design goals behind the Java language. With that in mind, I started my search by skimming through "The Java Language Environment" by James Gosling and Henry McGilton (Sun Microsystems), a white paper published in May 1996 that explains some of the reasoning behind Java's design.

    As the white paper states, the Java design team strove to make Java:

    * Simple, object oriented, and familiar
    * Robust and secure
    * Architecture neutral and portable
    * High performance
    * Interpreted, threaded, and dynamic



    The reasons for omitting multiple inheritance from the Java language mostly stem from the "simple, object oriented, and familiar" goal. As a simple language, Java's creators wanted a language that most developers could grasp without extensive training. To that end, they worked to make the language as similar to C++ as possible (familiar) without carrying over C++'s unnecessary complexity (simple).

    In the designers' opinion, multiple inheritance causes more problems and confusion than it solves. So they cut multiple inheritance from the language (just as they cut operator overloading). The designers' extensive C++ experience taught them that multiple inheritance just wasn't worth the headache.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact