super keyword program IN JAVA

/*2. WAP that illustrate how method can invoke a super class method. There is one supercalss A. class B extends class A and class C extends class B. Each of these classes define a getdescription() method that returns a string. That string includes description of the class plus description of each super class. Inherits each of these class and invoke the gerdescription() method.
"*/



class A
  {
     void  getdescription()
   {
    System.out.println("abhi ham ginnda he");
   }
 }

   
class B extends A
{
void  getdescription()
{
super.getdescription();
System.out.println("have class b ma cho");}
}
class C extends B
{

void  getdescription()
{
super.getdescription();
System.out.println("have class c ma cho");
}
}
class SuperDemo
{
  public static void main(String  []args)
   {
     C  a=new C();
   a.getdescription();
    }
}

Comments

Popular posts from this blog

Write a java program to calculate gross salary & net salary taking the following data

WAP a program that illustrates interface inheritance. Create two interface p1 and p2 . create Interface p which extends p1 and p2 and then create interface p12 which extends p12. Each interface declare one constants and one method. Create class Q which implements p12 and define all the methods of interface which displays value of constants

WAP that create interface on that you declare one method interest(p,r,n) then create two class simple and compound that implements interest and find simple and compound interest.