Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Confusion in Multiple inheritance in Java

  1. #1
    Member Ganeprog's Avatar
    Join Date
    Jan 2014
    Location
    Chennai,India
    Posts
    80
    My Mood
    Love
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Lightbulb Confusion in Multiple inheritance in Java

    Hi friends,



    Why multiple inheritance is not supported in java?At the same time why and how multiple inheritance is supported in c++.
    Please explain with clear example.

    Then how the "Interface" concept fulfil the multiple inheritance in java



    Thanks in advance


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,344
    My Mood
    Hungover
    Thanks
    144
    Thanked 625 Times in 536 Posts

    Default Re: Confusion in Multiple inheritance in Java

    We aren't going to do your homework for you. What has your research told you? Have you written any example programs to test your assumptions?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Member Ganeprog's Avatar
    Join Date
    Jan 2014
    Location
    Chennai,India
    Posts
    80
    My Mood
    Love
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default Re: Confusion in Multiple inheritance in Java

    I tried in programs but i am getting identifier error,syntax error like that. I am not able to use two extends keywords in programs. I searched in google also got something but not satisfied with tat. Still in confusion.

    If anybody clear with this please explain soon

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,344
    My Mood
    Hungover
    Thanks
    144
    Thanked 625 Times in 536 Posts

    Default Re: Confusion in Multiple inheritance in Java

    A class can only extend one other class. Recommended reading: Inheritance (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Member andbin's Avatar
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    443
    Thanks
    4
    Thanked 122 Times in 114 Posts

    Default Re: Confusion in Multiple inheritance in Java

    Quote Originally Posted by Ganeprog View Post
    Why multiple inheritance is not supported in java?At the same time why and how multiple inheritance is supported in c++.
    Then how the "Interface" concept fulfil the multiple inheritance in java
    Something (perhaps not all) is explained in the Java tutorial: Inheritance (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)

    Quote Originally Posted by Ganeprog View Post
    I am not able to use two extends keywords in programs.
    The extends keyword can only be used:
    a) In a class to extend 1 other class.
    b) In an interface to extend N other interfaces.

    P.S. "extends" is also used for bounds in Generics ... but it's all another story.
    Andrea, www.andbin.netSCJP 5 (91%) – SCWCD 5 (94%)

    Useful links for Java beginnersMy new project Java Examples on Google Code

Similar Threads

  1. AVL tree confusion, syntax confusion, just general confusion really...
    By platterofhotfish in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 18th, 2013, 06:04 AM
  2. Confusion in JAVA.................???
    By gbiz1124 in forum AWT / Java Swing
    Replies: 1
    Last Post: October 16th, 2012, 11:39 AM
  3. Confusion about inheritance
    By MeteoricDragon in forum What's Wrong With My Code?
    Replies: 6
    Last Post: May 17th, 2012, 06:17 PM
  4. Replies: 1
    Last Post: April 26th, 2012, 10:06 AM
  5. why java does not support multiple inheritance?
    By venkatsairam in forum Object Oriented Programming
    Replies: 3
    Last Post: January 18th, 2012, 04:25 PM