Java Program for an application that explain super keywords, WAP in Java for super keywords
Programclass base
{
int i;
base(int a)
{
i=a;
}
void show()
{
System.out.println("Base:"+i);
}
}
class derived extends base
{
int i,j;
derived(int a,int b,int c)
{
super(a);
i=b;
j=c;
}
void show()
{
super.show();
System.out.println("Base i:"+super.i);
System.out.println("Derived i:"+i);
System.out.println("Derived j:"+i);
}
}
class superEx
{
public static void main(String args[])
{
derived d = new derived(10,20,30);
d.show();
}
}
No comments:
Post a Comment