abstract class Abs
{
abstract void show();
}
class Sub extends Abs
{
void show()
{
System.out.println("Example of Abstract class");
}
}
public class Twenty{
public static void main(String args[])
{
Sub ob=new Sub();
ob.show();
}
class M
{
int i,j;
M(int a,int b)
{
i=a;
j=b;
}
void show()
{
System.out.println("i and j: "+i+" "+j);
}
}
class X extends M
{
int k;
X(int a,int b,int c)
{
super(a,b);
k=c;
}
void show()
{
System.out.println("k: "+k);
}
}
public class Nineteen {
public static void main(String args[])
{
X obj=new X(3,2,5);
obj.show();
}
class C
{
int i;
}
class D extends C
{
int i;
D(int a,int b)
{
super.i=a;
i=b;
}
void show()
{
System.out.println("i in Parent class: "+super.i);
System.out.println("i in Child class: "+i);
}
}
public class Eighteen {
public static void main(String args[])
{
D subob=new D(4,5);
subob.show();
}
class A
{
int i,j;
void show()
{
System.out.println("i and j: "+i+" "+j);
}
}
class B extends A
{
int k;
void show()
{
System.out.println("k: "+k);
}
void sum()
{
System.out.println("i+j+k: "+(i+j+k));
}
}
public class Seventeen {
public static void main(String args[])
{
A SupOb=new A();
B SubOb=new B();
SupOb.i=10;
SupOb.j=15;
SupOb.show();
SubOb.k=20;
SubOb.show();
SubOb.i=5;
SubOb.j=18;
SubOb.k=7;
SubOb.sum();
}