Arnab_Manna

(bank)abstraction3.java

Nov 27th, 2021
845
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. abstract class Bank{
  2.     abstract int getRateOfInterest();}
  3.  
  4. class SBI extends Bank{
  5.     int getRateOfInterest()
  6.     {return 7;}
  7. }
  8.  
  9. class PNB extends Bank{
  10.     int getRateOfInterest()
  11.     {return 8;}
  12. }
  13.  
  14. class TestBank{
  15.     public static void main(String args[]){
  16.         Bank b;
  17.         b=new SBI();
  18.         System.out.println("Rate of Interest is :"+b.getRateOfInterest()+"%");
  19.         b=new PNB();
  20.         System.out.println("Rate of Interest is :"+b.getRateOfInterest()+"%");
  21.     }
  22. }
RAW Paste Data