Java Program of Bank – Abstract concept


Banks are supposed to implement their own method that returns back the rate of interest for personal loans. To implement this scenario in SBI and PNB banks they are supposed to extend the Bank class provided by the RBI that has a single abstract method called getRateOfInterest() that returns back an integer.

Develop an automated module wherein the banks SBI and PNB that have their own classes as SBI and PNB that extend from the BANK class and implements the abstract method.

The current rate of interest provided by SBI is 7% and that of PNB is 8 %

Implement the above scenario.

Sample Input and Output

Rate of Interest in SBI is: 7 %

Rate of Interest in PNB is : 8 %


public class TestBank{
    public static void main (String[] args) {
    Bank s=new SBI();
    Bank p=new PNB();
    System.out.println("Rate of Interest in SBI is: "+s.getRateOfInterest()+" %");
    System.out.println("Rate of Interest in PNB is: "+p.getRateOfInterest()+" %");

public class SBI extends Bank{
    public int getRateOfInterest(){
        return 7;

public class PNB extends Bank{
    public int getRateOfInterest(){
        return 8;

public abstract class Bank{
    public abstract int getRateOfInterest();


  1. Interest Calculator – Interface Concept
  2. Bank – Abstract concept
  3. Inheritance – Account
  4. Contact Details of Hosteller
  5. PF and Salary Calculation
  6. Check for Existence of Customer – equals method
  7. Account Manipulation – Abstract class
  8. Employee Loan Eligibility – Polymorphism

Leave a Comment

Your email address will not be published. Required fields are marked *