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