SHARE
TWEET

Untitled

a guest Jul 19th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class RunBank
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         //static or early binding of object
  6.        
  7.         //upcasting
  8.         Bank nabilBank = new Bank();
  9.        
  10.         System.out.println("Bank Name = "+nabilBank.getName());
  11.         System.out.println("Interest Rate "+nabilBank.getRate());
  12.        
  13.         RunBank runBank =  new RunBank();
  14.         runBank.displayBankInfo(nabilBank);
  15.        
  16.         runBank.displayBankInfo(new PrabhuBank());
  17.        
  18.    
  19.    
  20.    
  21.     }
  22.    
  23.    
  24.      // dynamic/late binding of object
  25.      
  26.     public void displayBankInfo(CentralBank bank)
  27.     {
  28.         System.out.println("Bank Name = "+bank.getName());
  29.         System.out.println("Interest Rate "+bank.getRate());
  30.        
  31.  
  32.     }
  33.    
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top