Types of inheritance:

Types of inheritance Types of inheritance1 Note: In java multiple inheritance is not allowed. Assignment: Why multiple inheritance is not allowed in java ? Types of inheritance2
Note: It is also not allowed in java. Example: Types of inheritance3
        class Dot
        {
          public void drawDot()
          {
           System.out.println(".");
          }
        }
        public class Rect
        {
          public static void main(String[ ] args)
          { 
            Rect r= new Rect();
            r.drawRect();
           }
         }
         class Rect extends Dot
         {
           int len,bred;
           public Rect(int l, int b)
           {
             len=l;
             bred= b;
           }
          public void drawRect()
          {
            for(int i=0; i<bred; i++)
            {
            for(int j=0;j<len;j++)
            {
               drawDot();
            }
            System.out.println();
           }
          }
        }
Example: Inheritance1
   class Parent 
   {
       public void getCycle()
       {
         System.out.println("I have cycle");
       }
       public void getBike()
       {
          System.out.println("I have Yamaha bike");
       }
    }
   class Child extends Parent
   {
      public void getCar()
      {
        System.out.println("I hava a swift car");
      }
    }
     public class MainClass
     {
       public static void main(String[ ] args)
       {
         Parent p= new Parent();
         p.getCycle();
         p.getBike();
         p.getCar();
         Child c=new Child();
         c.getCycle();
         c.getBike();
         c.getCar();
      }
   }