Custom Search

Wednesday, 12 September 2012

Java Program for an application that explain super keywords, WAP in Java for super keywords


Java Program for an application that explain super keywords, WAP in Java for super keywords

Program
class 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

Laptops