Practical 24


Aim:- Perform the demonstration of Abstract Class.

JAVA Code :-

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

Programs

Home Aim:- Write a program to convert rupees to dollar. (60rupees=1 dollar). Aim:- Write a program that calculate percentage marks...