Sunday, 16 August 2015

Java Tutorial : Why Multiple Inheritance not supported in Java?



Click here to watch in Youtube :
https://www.youtube.com/watch?v=JJDli5-VQL0&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge

C.java
class A
{
    public void displayMessage()
    {
        System.out.println("Calling Class A displayMessage method");
    }
    
}

class B
{
    public void displayMessage()
    {
        System.out.println("Calling Class B displayMessage method");
    }
}

class C extends A,B //suppose if it were 
{
    public static void main(String[] args)
    {
         C obj=new C();
         /*
          * Now which displayMessage() method would be invoked?
          * Class A displayMessage() method or Class B displayMessage() method?
          */
         obj.displayMessage();
    }
}
To Download NoMultipleInheritanceDemoApp Project Click the below link
https://sites.google.com/site/javaee4321/java/NoMultipleInheritanceDemoApp.zip?attredirects=0&d=1

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment