Java Program 5 – Interface

Program

interface Employee{

    public void applyLeave();
    public void getSalary();
    
}

interface EmployeeManager{

    public void approveLeave();
    
}

class Manager implements Employee{

    public void applyLeave(){
        
        System.out.println("Apply Leave…");
    }
    
    public void getSalary(){
        
        System.out.println("Get Salary…");
    }
}

class testInterface{

    public static void main(String args[]){
    
        Manager e=new Manager();
        e.applyLeave();
        e.getSalary();
    }
}

 


Output

D:\a5518\day2>javac interface.java

D:\a5518\day2>java testInterface
Apply Leave…
Get Salary…

D:\a5518\day2>


 

You can leave a response, or trackback from your own site.

Leave a Reply