Q:

Java - Single Inheritance concept

0

This Program is used to demonstrate the Single Inheritance concept.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

class A

  {

      int i,j;



     void showij()

       {          System.out.println(i+j);     

       } 

}

class B extends A

  {

     int k;

        void showk()

       {

           System.out.println(k);     

        }

      void sum()

        { 

           System.out.println(i+j+k);       

        }

   }

class test6

  {

      public static void main(String arg[])

        {

           A t = new A();

           B t1 = new B();



           t.i = 10;        t.j =20;

           t.showij();



           t1.i = 15;        t1.j =25;   t1.k = 35;

           t1.showij();

       }

 }    

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now