Java SE 8 Programmer II — Question 38

Given:
interface Doable {
public void doSomething (String s);
}
Which two class definitions compile? (Choose two.)

Answer options

Correct answer: C, E

Explanation

Option C is correct because it provides an implementation of the doSomething method with the correct name and signature, even though the parameter type is different. Option E is also correct as it correctly implements the doSomething method with the appropriate signature and includes additional methods. Options A and D do not implement the required method correctly, while B is abstract and does not provide a concrete implementation of the method.