Aim:- Perform the demonstration
of Abstract Class.
import java.lang.*;
abstract class Bank
{
abstract void interest();
}
class SBI extends Bank
{
void interest()
{
System.out.println("SBI gives 7%
interest");
}
}
class BOB extends Bank
{
void interest()
{
System.out.println("BOB gives 5.5%
interest");
}
}
class TestAbstract
{
public static void main(String[] args)
{
SBI s=new SBI();
BOB b=new BOB();
s.interest();
b.interest();
}
}
Output:-
No comments:
Post a Comment