Answer to Question #348992 in Java | JSP | JSF for stephanie

Question #348992

Create an interface called EmployeeInterface. This interface has the following abstract method:

public void workingOn(String task);

The Employee class implements this interface, and provides an implementation for workingOn() which displays that the employee is working on a certain task.

(Note what happens if you don’t  implement workingOn().)




1
Expert's answer
2022-06-07T17:44:28-0400
interface EmployeeInterface {
    void workingOn(String task);
}

class Employee implements EmployeeInterface {
    // If `workingOn` method is not implemented, then a compilation error happens
    public void workingOn(String task) {
        System.out.println("The employee is working on " + task);
    }
}

class Test {
    public static void main(String[] args) {
        Employee employee = new Employee();
        employee.workingOn("coding");
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS