class A
{
int i, j;
A(int a, int b) {
i = a;
j = b;
}
void show() // display i and j
{
System.out.println("i and j: " + i + " " + j);
}
}
class B extends A
{
int k;
B(int a, int b, int c)
{
super(a, b);
k = c;
}
void show()
{
System.out.println("k: " + k);
}
}
class Override {
public static void main(String args[])
{
B subOb = new B(1, 2, 3);
subOb.show(); // this calls show() in B
}
}
Subscribe to:
Post Comments (Atom)
1 comment:
Super(a,b) what it's function ,is it bult in function or else
Post a Comment