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
Post a Comment