Implement Super
Class as abstract and define two abstract method in it and implement multilevel
inheritance.
Program:
abstract class A
{
int i=10;
abstract
void cal( );
abstract
void Display( );
}
abstract class B extends A
{
void
Display()
{
System.out.println( +i);
}
}
class C
extends B
{
void cal( )
{
i=i+10;
}
}
class Sk22
{
public
static void main(String args[])
{
C obj=new
C();
obj.Display();
obj.cal();
obj.Display();
}
}
Compile:
D:\>javac
Sk22.java
Run:
D:\>java Sk22
Output:
10
20
0 Comments