Java Program to calculate employee salary using multiple interface


In this program, You will learn how to calculate employee salary using multiple interface in java.


interface Clerk { }

interface Peon { }

class Admin implements Clerk, Peon { }

Example: How to calculate employee salary using multiple interface in java.

interface Clerk {
    int csal = 10000;
}

interface Peon {
    int psal = 8000;
}

class Main implements Clerk, Peon {

    int tsal;

    void findSal() {
        tsal = csal + psal;
        System.out.println("Clerk Salary is :" + csal);
        System.out.println("Peon Salary is :" + psal);
        System.out.println("Total Salary is :" + tsal);
    }

    public static void main(String args[]) {
        Main ad = new Main();
        ad.findSal();
    }
}

Output:

Clerk Salary is :10000
Peon Salary is :8000
Total Salary is :18000

Xiith is created for educational, experimental, and schooling purpose. Examples on Xiith are made easier to make a better or basic understanding. Tutorials, testimonials, and examples are continuously checked to avoid delusion, but we cannot take complete responsibility of all programs on Xiith. When you are operating this site, you have to agree to read and accept our terms of use, cookie and privacy policy.Copyright © 2020 by Xiith. All Rights Reserved. About us.