Program to implement the Multiple Inheritance (Bank Interface, Customer & Account classes)

In this program, we have achieved multiple inheritance using interface. We have created an interface Bank having data members rate, no_of_years and method show( ). After that class Customer is created which has data members cust_name, cust_id and method display( ). Finally we declare the Account class having data members acc_no, acc_bal and method interest( ). In that we have extended Customerclass and implemented Bank interface as shown in program.

/* Program to implement the Multiple Inheritance */

interface Bank {
 float rate = 12.0f;
 int no_of_years=3;
 void show();

class Customer {
 String cust_name;
 int cust_id;
 Customer(String n,int i) {
  cust_name = n;
  cust_id = i;
 void display() {
  System.out.println("Customer Name = "+cust_name);
  System.out.println("Customer Id = "+cust_id);

class Account  extends Customer implements Bank {
 int acc_no;
 float acc_bal;
 Account(String n,int b,int x,float y) {
 public void show() {
  System.out.println("Account No. = "+acc_no);
  System.out.println("Account Balance = "+acc_bal);
 void interest() {
  float intr = (rate*acc_bal*no_of_years)/100;
  System.out.println("Interest = "+intr);

public class Acct_Details {

 public static void main (String[] args) 
  Account ac = new Account("Sameer",8,4052,5000);
C:\>java Acct_Details
Customer Name = Sameer
Customer Id = 8
Account No. = 4052
Account Balance = 5000.0
Interest = 1800.0


  1. Good But you try give input user.

  2. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. Walmart Customer Service

  3. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. Syndicate bank customer care

  4. In the event that you are in the United States, a bank in Singapore is a seaward bank to you. In this manner, the possibility of seaward banking is relative.
    chase routing number


Post a Comment

Popular posts from this blog

Program to define a class 'employee' with data members as empid, name and salary. Accept data for 5 objects using Array of objects and print it.

Program to input age from user and throw user-defined exception if entered age is negative

Define a class Student with four data members such as name, roll no.,sub1, and sub2. Define appropriate methods to initialize and display the values of data members. Also calculate total marks and percentage scored by student.